Base:
property
ContainingType
Microsoft.CodeAnalysis.CSharp.Symbol.ContainingType
155 references to ContainingType
Microsoft.CodeAnalysis.CSharp (131)
Lowering\ClosureConversion\ClosureConversion.cs (1)
1528translatedLambdaContainer = synthesizedMethod.ContainingType;
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
54var lambdaFrame = ContainingType as SynthesizedClosureEnvironment;
Symbols\Extensions\SynthesizedExtensionMarker.cs (2)
41var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 107ContainingType.TypeParameters.Any(static (p, name) => p.Name == name, name))
Symbols\Source\SourceConstructorSymbol.cs (6)
187else if (ContainingType.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride) 189diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this); 191else if (ContainingType.IsStatic && methodKind == MethodKind.Constructor) 195else if (IsPartial && !ContainingType.IsPartial()) 222if (this.ContainingType is SourceMemberContainerTypeSymbol { AnyMemberHasAttributes: true }) 237: ((SourceMemberContainerTypeSymbol)ContainingType).IsNullableEnabledForConstructorsAndInitializers(IsStatic);
Symbols\Source\SourceConstructorSymbolBase.cs (4)
66ContainingType.Name == ((ConstructorDeclarationSyntax)this.SyntaxNode).Identifier.ValueText) 74if (this.IsVararg && (IsGenericMethod || ContainingType.IsGenericType || _lazyParameters.Length > 0 && _lazyParameters[_lazyParameters.Length - 1].IsParams)) 220var containingType = (SourceNamedTypeSymbol)this.ContainingType; 249if (ContainingType.IsWellKnownSetsRequiredMembersAttribute())
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
356: base((SourceNamedTypeSymbol)invoke.ContainingType, iAsyncResultType, syntax, MethodKind.Ordinary, RefKind.None, DeclarationModifiers.Virtual | DeclarationModifiers.Public) 394: base((SourceNamedTypeSymbol)invoke.ContainingType, invoke.ReturnTypeWithAnnotations, syntax, MethodKind.Ordinary, invoke.RefKind, DeclarationModifiers.Virtual | DeclarationModifiers.Public)
Symbols\Source\SourceDestructorSymbol.cs (1)
173return (object)this.ContainingType.BaseTypeNoUseSiteDiagnostics == null;
Symbols\Source\SourceMemberMethodSymbol.cs (3)
381if (this.GetIsNewExtensionMember() && ContainingType.ExtensionParameter is { } extensionParameter) 395NamedTypeSymbol containingType = ContainingType; 984if (IsDeclaredReadOnly && !ContainingType.IsReadOnly)
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
66if (!ContainingType.IsPartial()) 139TypeSymbol.CheckModifierMismatchOnImplementingMember(this.ContainingType, this, overriddenOrExplicitlyImplementedMethod, isExplicit: true, diagnostics);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (26)
143(this.ContainingType.SpecialType == SpecialType.System_TypedReference || this.ContainingType.SpecialType == SpecialType.System_ArgIterator)) 228else if ((object)ContainingType.ContainingType != null) 230diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, _location, ContainingType.Name); 232else if (!ContainingType.IsScriptClass && !(ContainingType.IsStatic && ContainingType.Arity == 0)) 251else if (ContainingType is { IsExtension: true, ExtensionParameter.Name: "" } && !IsStatic) 424var sourceContainer = this.ContainingType as SourceMemberContainerTypeSymbol; 824Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 826bool isExplicitInterfaceImplementationInInterface = isExplicitInterfaceImplementation && ContainingType.IsInterface; 863else if (IsSealed && ContainingType.TypeKind == TypeKind.Struct) 871diagnostics.Add(ErrorFacts.GetStaticClassReturnCode(ContainingType.IsInterfaceType()), location, ReturnType); 885else if (IsAbstract && ContainingType.TypeKind == TypeKind.Struct) 890else if (IsVirtual && ContainingType.TypeKind == TypeKind.Struct) 900else if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission)) 903diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType); 905else if (IsVirtual && ContainingType.IsSealed) 908diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType); 918else if (ContainingType.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride) 920diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this); 922else if (ContainingType.IsStatic && !IsStatic) 926else if (isVararg && (IsGenericMethod || ContainingType.IsGenericType || Parameters.Length > 0 && Parameters[Parameters.Length - 1].IsParams)) 1155var tpEnclosing = ContainingType.FindEnclosingTypeParameter(name);
Symbols\Source\SourcePropertyAccessorSymbol.cs (11)
482return ContainingType.IsStructType() && 530if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission)) 533diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType); 535else if (IsVirtual && ContainingType.IsSealed && ContainingType.TypeKind != TypeKind.Struct) // error CS0106 on struct already 538diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType); 544else if (ContainingType.IsSealed && localAccessibility.HasProtected() && !this.IsOverride) 546diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this); 558else if (ContainingType.IsExtension && IsInitOnly)
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (21)
63if (this.ContainingType.IsInterface && 72if (this.ContainingType.IsStatic) 81if (this.ContainingType is { IsExtension: true, ExtensionParameter.Type.IsStatic: true }) 145else if (IsSealed && !IsOverride && !(IsExplicitInterfaceImplementation && ContainingType.IsInterface && IsAbstract)) 154else if (IsAbstract && !ContainingType.IsAbstract && !ContainingType.IsInterface) 157diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType); 159else if (IsVirtual && ContainingType.IsSealed) 162diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType); 372if (this.ContainingType.IsStatic) 385if (ContainingType is { IsExtension: true, ExtensionParameter: { Type.IsStatic: false } extensionParameter } && !IsStatic && 577return ContainingType.IsInterface && (IsAbstract || IsVirtual); 668if ((ContainingType.SpecialType == SpecialType.System_Nullable_T) 806(ContainingType.IsExtension ? 875(ContainingType.IsExtension ? 895if (ContainingType is { IsExtension: true, ExtensionParameter.Type: var extendedType }) 921return type.Equals(this.ContainingType, ComparisonForUserDefinedOperators); 935return IsSelfConstrainedTypeParameter(type, this.ContainingType); 950(ContainingType.IsExtension ? ErrorCode.ERR_BadExtensionShiftOperatorSignature : ErrorCode.ERR_BadShiftOperatorSignature), 972(ContainingType.IsExtension ? ErrorCode.ERR_BadExtensionBinaryOperatorSignature : ErrorCode.ERR_BadBinaryOperatorSignature), 984diagnostics.Add(ErrorCode.ERR_BadAbstractEqualityOperatorSignature, this.GetFirstLocation(), this.ContainingType);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
89public new SourceMemberContainerTypeSymbol ContainingType => (SourceMemberContainerTypeSymbol)base.ContainingType;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (4)
32TypeWithAnnotations.Create(ContainingType.BaseTypeNoUseSiteDiagnostics, NullableAnnotation.Annotated), 45!overridden.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions)) 47diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, GetFirstLocation(), this, ContainingType.BaseTypeNoUseSiteDiagnostics); 67ContainingType.GetMembersUnordered().OfType<SynthesizedRecordObjEquals>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (5)
98return (ReturnType: !ContainingAssembly.RuntimeSupportsCovariantReturnsOfClasses && VirtualCloneInBase(ContainingType) is { } baseClone ? 100TypeWithAnnotations.Create(isNullableEnabled: true, ContainingType), 110var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 120var members = ContainingType.InstanceConstructors; 125ctor.Parameters[0].Type.Equals(ContainingType, TypeCompareKind.AllIgnoreOptions))
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
51var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics);
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
173F.CloseMethod(F.Block(F.Return(F.Typeof(ContainingType, ReturnType))));
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperator.cs (4)
34var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 43foreach (var member in ContainingType.GetMembers(WellKnownMemberNames.ObjectEquals)) 47candidate.Parameters[0].Type.Equals(ContainingType, TypeCompareKind.AllIgnoreOptions)) 65if (ContainingType.IsRecordStruct)
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (3)
70var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated; 74TypeWithAnnotations.Create(ContainingType, annotation), 77TypeWithAnnotations.Create(ContainingType, annotation),
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (8)
36var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated; 40TypeWithAnnotations.Create(ContainingType, annotation), 48var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 58bool isRecordStruct = ContainingType.IsRecordStruct; 67else if (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType()) 105MethodSymbol? baseEquals = ContainingType.GetMembersUnordered().OfType<SynthesizedRecordBaseEquals>().Single().OverriddenMethod; 107if (baseEquals is null || !baseEquals.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions) || 132foreach (var f in ContainingType.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (3)
50if (ContainingType.IsRecordStruct) 54else if (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType()) 94foreach (var f in ContainingType.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordInequalityOperator.cs (2)
36var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 41F.CloseMethod(F.Block(F.Return(F.Not(F.Call(receiver: null, ContainingType.GetMembers(WellKnownMemberNames.EqualityOperatorName).OfType<SynthesizedRecordEqualityOperator>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordObjEquals.cs (5)
31var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated; 57if (ContainingType.IsRecordStruct) 62F.Is(paramAccess, ContainingType), 63F.Call(F.This(), _typedRecordEquals, F.Convert(ContainingType, paramAccess))); 69expression = F.Call(F.This(), _typedRecordEquals, F.As(paramAccess, ContainingType));
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (9)
93var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated; 110!overridden.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions)) 112diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, GetFirstLocation(), this, ContainingType.BaseTypeNoUseSiteDiagnostics); 118var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 121ImmutableArray<Symbol> printableMembers = ContainingType.GetMembers().WhereAsArray(m => isPrintable(m)); 132if (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType() || ContainingType.IsRecordStruct) 142if (!ContainingType.IsRecordStruct) 164var basePrintCall = F.Call(receiver: F.Base(ContainingType.BaseTypeNoUseSiteDiagnostics), basePrintMethod, builder);
Symbols\Synthesized\Records\SynthesizedRecordToString.cs (3)
42var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated; 55CSharpCompilation compilation = ContainingType.DeclaringCompilation; 66block.Add(makeAppendString(F, builderLocal, ContainingType.Name));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (1)
109if (!IsAbstract && !AssociatedEvent.IsWindowsRuntimeEvent && !ContainingType.IsStructType() &&
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
227result = new InContainerBinder(ContainingType, result);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
FlowAnalysis\FlowTestBase.cs (2)
27if (sourceSymbol == null || sourceSymbol.ContainingType.IsDelegateType()) 32var compilationState = new TypeCompilationState(sourceSymbol.ContainingType, compilation, null);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (21)
Semantics\ImplicitlyTypeArraysTests.cs (1)
38var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.ContainingType, compilation, null), diagnostics);
Semantics\OperatorTests.cs (1)
3204var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.ContainingType, compilation, null), diagnostics);
Semantics\OverloadResolutionTestBase.cs (1)
37var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.ContainingType, compilation, null), diagnostics);
Semantics\TopLevelStatementsTests.cs (18)
52Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 54Assert.Equal("Program", entryPoint.ContainingType.Name); 9055Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 9057Assert.Equal("Program", entryPoint.ContainingType.Name); 9058Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9110Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 9112Assert.Equal("Program", entryPoint.ContainingType.Name); 9113Assert.Equal(Accessibility.Public, entryPoint.ContainingType.DeclaredAccessibility); 9152Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 9154Assert.Equal("Program", entryPoint.ContainingType.Name); 9155Assert.Equal(Accessibility.Public, entryPoint.ContainingType.DeclaredAccessibility); 9177Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9199Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9228Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9230Assert.True(entryPoint.ContainingType.IsReferenceType); 9326Assert.Equal("Base", entryPoint.ContainingType.BaseType().ToTestDisplayString()); 9327Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9328Assert.False(entryPoint.ContainingType.IsStatic);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\ExpressionBodiedMethodTests.cs (1)
290var implements = method.ContainingType.FindImplementationForInterfaceMember(iM);