Base:
property
ContainingType
Microsoft.CodeAnalysis.CSharp.Symbol.ContainingType
157 references to ContainingType
Microsoft.CodeAnalysis.CSharp (133)
Lowering\ClosureConversion\ClosureConversion.cs (1)
1497translatedLambdaContainer = synthesizedMethod.ContainingType;
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (1)
54var lambdaFrame = ContainingType as SynthesizedClosureEnvironment;
Lowering\SynthesizedMethodBaseSymbol.cs (1)
76if (ContainingType.IsImplicitlyDeclared)
Symbols\Source\SourceConstructorSymbol.cs (6)
114bool isInterface = ContainingType.IsInterface; 125ContainingType.Name == ((ConstructorDeclarationSyntax)this.SyntaxNode).Identifier.ValueText) 151else if (ContainingType.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride) 153diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this); 155else if (ContainingType.IsStatic && methodKind == MethodKind.Constructor) 178((SourceMemberContainerTypeSymbol)ContainingType).IsNullableEnabledForConstructorsAndInitializers(IsStatic);
Symbols\Source\SourceConstructorSymbolBase.cs (4)
67ContainingType.Name == ((ConstructorDeclarationSyntax)this.SyntaxNode).Identifier.ValueText) 75if (_lazyIsVararg && (IsGenericMethod || ContainingType.IsGenericType || _lazyParameters.Length > 0 && _lazyParameters[_lazyParameters.Length - 1].IsParams)) 235var containingType = (SourceNamedTypeSymbol)this.ContainingType; 264if (ContainingType.IsWellKnownSetsRequiredMembersAttribute())
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
370: base((SourceNamedTypeSymbol)invoke.ContainingType, iAsyncResultType, syntax, MethodKind.Ordinary, DeclarationModifiers.Virtual | DeclarationModifiers.Public) 413: base((SourceNamedTypeSymbol)invoke.ContainingType, invoke.ReturnTypeWithAnnotations, syntax, MethodKind.Ordinary, DeclarationModifiers.Virtual | DeclarationModifiers.Public)
Symbols\Source\SourceDestructorSymbol.cs (2)
131var mods = ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: false, isForInterfaceMember: ContainingType.IsInterface, modifiers, DeclarationModifiers.None, allowedModifiers, location, diagnostics, out modifierErrors); 180return (object)this.ContainingType.BaseTypeNoUseSiteDiagnostics == null;
Symbols\Source\SourceMemberMethodSymbol.cs (5)
277if (ContainingType.HasFileLocalTypes()) 284diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Locations[0], returnType.Type, ContainingType); 291diagnostics.Add(ErrorCode.ERR_FileTypeDisallowedInSignature, Locations[0], param.Type, ContainingType); 845if (IsDeclaredReadOnly && !ContainingType.IsReadOnly) 901if (IsDeclaredReadOnly && !ContainingType.IsReadOnly)
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (2)
67if (!ContainingType.IsPartial()) 146TypeSymbol.CheckNullableReferenceTypeAndScopedMismatchOnImplementingMember(this.ContainingType, this, overriddenOrExplicitlyImplementedMethod, isExplicit: true, diagnostics);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (10)
154(this.ContainingType.SpecialType == SpecialType.System_TypedReference || this.ContainingType.SpecialType == SpecialType.System_ArgIterator)) 239else if ((object)ContainingType.ContainingType != null) 241diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, location, ContainingType.Name); 243else if (!ContainingType.IsScriptClass && !(ContainingType.IsStatic && ContainingType.Arity == 0)) 509var sourceContainer = this.ContainingType as SourceMemberContainerTypeSymbol; 527return ModifierUtils.MakeAndCheckNonTypeMemberModifiers(isOrdinaryMethod: true, isForInterfaceMember: ContainingType.IsInterface, 575var tpEnclosing = ContainingType.FindEnclosingTypeParameter(name);
Symbols\Source\SourceOrdinaryMethodSymbolBase.cs (19)
205bool isInterface = this.ContainingType.IsInterface; 255if (ContainingType.IsStructType()) 276Debug.Assert(ContainingType.IsStructType()); 322Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 324bool isExplicitInterfaceImplementationInInterface = isExplicitInterfaceImplementation && ContainingType.IsInterface; 361else if (IsSealed && ContainingType.TypeKind == TypeKind.Struct) 369diagnostics.Add(ErrorFacts.GetStaticClassReturnCode(ContainingType.IsInterfaceType()), location, ReturnType); 383else if (IsAbstract && ContainingType.TypeKind == TypeKind.Struct) 388else if (IsVirtual && ContainingType.TypeKind == TypeKind.Struct) 398else if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission)) 401diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType); 403else if (IsVirtual && ContainingType.IsSealed) 406diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType); 416else if (ContainingType.IsSealed && this.DeclaredAccessibility.HasProtected() && !this.IsOverride) 418diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this); 420else if (ContainingType.IsStatic && !IsStatic) 424else if (isVararg && (IsGenericMethod || ContainingType.IsGenericType || Parameters.Length > 0 && Parameters[Parameters.Length - 1].IsParams))
Symbols\Source\SourcePropertyAccessorSymbol.cs (12)
482return ContainingType.IsStructType() && 500if (this.ContainingType.IsStructType()) 507bool isInterface = this.ContainingType.IsInterface; 528if (IsAbstract && !ContainingType.IsAbstract && (ContainingType.TypeKind == TypeKind.Class || ContainingType.TypeKind == TypeKind.Submission)) 531diagnostics.Add(ErrorCode.ERR_AbstractInConcreteClass, location, this, ContainingType); 533else if (IsVirtual && ContainingType.IsSealed && ContainingType.TypeKind != TypeKind.Struct) // error CS0106 on struct already 536diagnostics.Add(ErrorCode.ERR_NewVirtualInSealed, location, this, ContainingType); 542else if (ContainingType.IsSealed && localAccessibility.HasProtected() && !this.IsOverride) 544diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(ContainingType), location, this);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (7)
52if (this.ContainingType.IsInterface && 61if (this.ContainingType.IsStatic) 278if (this.ContainingType.IsStatic) 473if ((ContainingType.SpecialType == SpecialType.System_Nullable_T) 695return type.Equals(this.ContainingType, ComparisonForUserDefinedOperators); 709return IsSelfConstrainedTypeParameter(type, this.ContainingType); 752diagnostics.Add(ErrorCode.ERR_BadAbstractEqualityOperatorSignature, this.Locations[0], this.ContainingType);
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
49public new SourceMemberContainerTypeSymbol ContainingType => (SourceMemberContainerTypeSymbol)base.ContainingType;
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (4)
39TypeWithAnnotations.Create(ContainingType.BaseTypeNoUseSiteDiagnostics, NullableAnnotation.Annotated), 54!overridden.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions)) 56diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, Locations[0], this, ContainingType.BaseTypeNoUseSiteDiagnostics); 76ContainingType.GetMembersUnordered().OfType<SynthesizedRecordObjEquals>().Single(),
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (7)
42result |= ContainingType.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual; 45if (ContainingType.IsAbstract) 88NamedTypeSymbol baseType = ContainingType.BaseTypeNoUseSiteDiagnostics; 103TypeWithAnnotations.Create(isNullableEnabled: true, ContainingType), 115var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 125var members = ContainingType.InstanceConstructors; 130ctor.Parameters[0].Type.Equals(ContainingType, TypeCompareKind.AllIgnoreOptions))
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
61var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics);
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (1)
173F.CloseMethod(F.Block(F.Return(F.Typeof(ContainingType))));
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)
68var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated; 72TypeWithAnnotations.Create(ContainingType, annotation), 75TypeWithAnnotations.Create(ContainingType, annotation),
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (9)
30DeclarationModifiers result = DeclarationModifiers.Public | (ContainingType.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual); 40var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.Annotated; 44TypeWithAnnotations.Create(ContainingType, annotation), 54var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 64bool isRecordStruct = ContainingType.IsRecordStruct; 73else if (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType()) 111MethodSymbol? baseEquals = ContainingType.GetMembersUnordered().OfType<SynthesizedRecordBaseEquals>().Single().OverriddenMethod; 113if (baseEquals is null || !baseEquals.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions) || 138foreach (var f in ContainingType.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (3)
52if (ContainingType.IsRecordStruct) 56else if (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType()) 96foreach (var f in ContainingType.GetFieldsToEmit())
Symbols\Synthesized\Records\SynthesizedRecordInequalityOperator.cs (2)
41var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 46F.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; 59if (ContainingType.IsRecordStruct) 64F.Is(paramAccess, ContainingType), 65F.Call(F.This(), _typedRecordEquals, F.Convert(ContainingType, paramAccess))); 71expression = F.Call(F.This(), _typedRecordEquals, F.As(paramAccess, ContainingType));
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (16)
40var result = (ContainingType.IsRecordStruct || (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType() && ContainingType.IsSealed)) ? 44if (ContainingType.IsRecord && !ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType()) 50result |= ContainingType.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual; 62if (ContainingType.IsRecordStruct) 92var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated; 111!overridden.ContainingType.Equals(ContainingType.BaseTypeNoUseSiteDiagnostics, TypeCompareKind.AllIgnoreOptions)) 113diagnostics.Add(ErrorCode.ERR_DoesNotOverrideBaseMethod, Locations[0], this, ContainingType.BaseTypeNoUseSiteDiagnostics); 119var F = new SyntheticBoundNodeFactory(this, ContainingType.GetNonNullSyntaxNode(), compilationState, diagnostics); 122ImmutableArray<Symbol> printableMembers = ContainingType.GetMembers().WhereAsArray(m => isPrintable(m)); 133if (ContainingType.BaseTypeNoUseSiteDiagnostics.IsObjectType() || ContainingType.IsRecordStruct) 143if (!ContainingType.IsRecordStruct) 165var basePrintCall = F.Call(receiver: F.Base(ContainingType.BaseTypeNoUseSiteDiagnostics), basePrintMethod, builder);
Symbols\Synthesized\Records\SynthesizedRecordToString.cs (3)
43var annotation = ContainingType.IsRecordStruct ? NullableAnnotation.Oblivious : NullableAnnotation.NotAnnotated; 58CSharpCompilation compilation = ContainingType.DeclaringCompilation; 69block.Add(makeAppendString(F, builderLocal, ContainingType.Name));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (1)
85if (!IsAbstract && !AssociatedEvent.IsWindowsRuntimeEvent && !ContainingType.IsStructType() &&
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
228result = new InContainerBinder(ContainingType, result);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
FlowAnalysis\FlowTestBase.cs (2)
26if (sourceSymbol == null || sourceSymbol.ContainingType.IsDelegateType()) 31var compilationState = new TypeCompilationState(sourceSymbol.ContainingType, compilation, null);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (21)
Semantics\ImplicitlyTypeArraysTests.cs (1)
40var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.ContainingType, compilation, null), new BindingDiagnosticBag(diagnostics));
Semantics\OperatorTests.cs (1)
3204var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.ContainingType, compilation, null), new BindingDiagnosticBag(diagnostics));
Semantics\OverloadResolutionTestBase.cs (1)
36var block = MethodCompiler.BindSynthesizedMethodBody(method, new TypeCompilationState(method.ContainingType, compilation, null), new BindingDiagnosticBag(diagnostics));
Semantics\TopLevelStatementsTests.cs (18)
51Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 53Assert.Equal("Program", entryPoint.ContainingType.Name); 9042Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 9044Assert.Equal("Program", entryPoint.ContainingType.Name); 9045Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9097Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 9099Assert.Equal("Program", entryPoint.ContainingType.Name); 9100Assert.Equal(Accessibility.Public, entryPoint.ContainingType.DeclaredAccessibility); 9139Assert.True(entryPoint.ContainingType.CanBeReferencedByName); 9141Assert.Equal("Program", entryPoint.ContainingType.Name); 9142Assert.Equal(Accessibility.Public, entryPoint.ContainingType.DeclaredAccessibility); 9164Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9186Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9215Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9217Assert.True(entryPoint.ContainingType.IsReferenceType); 9313Assert.Equal("Base", entryPoint.ContainingType.BaseType().ToTestDisplayString()); 9314Assert.Equal(Accessibility.Internal, entryPoint.ContainingType.DeclaredAccessibility); 9315Assert.False(entryPoint.ContainingType.IsStatic);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\ExpressionBodiedMethodTests.cs (1)
290var implements = method.ContainingType.FindImplementationForInterfaceMember(iM);