6 implementations of ContainingType
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
32public INamedTypeSymbol ContainingType { get; protected set; }
Microsoft.CodeAnalysis.CSharp (2)
Symbols\PublicModel\PreprocessingSymbol.cs (1)
25INamedTypeSymbol? ISymbol.ContainingType => null;
Symbols\PublicModel\Symbol.cs (1)
71INamedTypeSymbol ISymbol.ContainingType
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
39public INamedTypeSymbol ContainingType => _symbol.ContainingType;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\Symbol.vb (1)
1223Private ReadOnly Property ISymbol_ContainingType As INamedTypeSymbol Implements ISymbol.ContainingType
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationSymbol.cs (1)
32public INamedTypeSymbol ContainingType { get; protected set; }
1084 references to ContainingType
ConfigurationSchemaGenerator (5)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
85INamedTypeSymbol? candidateBinderType = targetMethod.ContainingType;
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
58ContainingType: INamedTypeSymbol
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (1)
111IMethodReferenceOperation m when m.Method.MethodKind == MethodKind.Constructor => m.Method.ContainingType,
RuntimeSource\Configuration.Binder\Parser\Extensions.cs (1)
101string displayString = type.ContainingType is null
RuntimeSource\SourceGenerators\TypeModelHelper.cs (1)
26if (current.ContainingType is INamedTypeSymbol parent)
ILLink.CodeFixProvider (2)
BaseAttributeCodeFixProvider.cs (2)
139 for (var t = m.ContainingType; t is not null; t = t.ContainingType) {
ILLink.RoslynAnalyzer (29)
DynamicallyAccessedMembersAnalyzer.cs (2)
158 if (method.GetDynamicallyAccessedMemberTypes () != DynamicallyAccessedMemberTypes.None && !method.ContainingType.IsTypeInterestingForDataflow (isByRef: false)) 267 INamedTypeSymbol implementationType = implementationMethod.ContainingType;
INamedTypeSymbolExtensions.cs (1)
26 currentType = (INamespaceOrTypeSymbol?) currentType.ContainingType ?? currentType.ContainingNamespace;
ISymbolExtensions.cs (3)
150 sb.Append (symbol.ContainingType.ToDisplayString (ILLinkTypeDisplayFormat)); 162 sb.Append (methodSymbol.ContainingType.ToDisplayString (ILLinkTypeDisplayFormat)); 195 typeSymbol = typeSymbol.ContainingType;
RequiresAnalyzerBase.cs (3)
138 IMethodSymbol method => method.ContainingType, 139 IPropertySymbol property => property.ContainingType, 140 IEventSymbol @event => @event.ContainingType,
RequiresISymbolExtensions.cs (3)
26 return member.ContainingType.TryGetAttribute (requiresAttribute, out requiresAttributeData); 58 if (member.ContainingType is ITypeSymbol containingType && containingType.TryGetAttribute (attributeName, out requiresAttribute)) 66 foreach (var constructor in field.ContainingType.InstanceConstructors) {
TrimAnalysis\FlowAnnotations.cs (1)
140 if (!param.Method.Method.ContainingType.IsTypeInterestingForDataflow (isByRef: false))
TrimAnalysis\GenericArgumentDataFlow.cs (6)
19 type = type.ContainingType; 27 ProcessGenericArgumentDataFlow (location, method.ContainingType, reportDiagnostic); 32 ProcessGenericArgumentDataFlow (location, field.ContainingType, reportDiagnostic); 71 type = type.ContainingType; 90 return RequiresGenericArgumentDataFlow (method.ContainingType); 95 return RequiresGenericArgumentDataFlow (field.ContainingType);
TrimAnalysis\HandleCallAction.cs (1)
180 var type = method.Method.ContainingType;
TrimAnalysis\MethodProxy.cs (1)
20 internal partial bool IsDeclaredOnType (string fullTypeName) => IsTypeOf (Method.ContainingType, fullTypeName);
TrimAnalysis\MethodReturnValue.cs (1)
25 StaticType = new (isNewObj ? methodSymbol.ContainingType : methodSymbol.ReturnType);
TrimAnalysis\ParameterProxy.cs (2)
21 return Method.Method.ContainingType.IsValueType 48 ? new TypeProxy (Method.Method.ContainingType)
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
121 INamedTypeSymbol containingType = member.ContainingType; 126 containingType = containingType.ContainingType;
TrimAnalysis\TrimAnalysisVisitor.cs (3)
159 case "EmptyTypes" when field.ContainingType.IsTypeOf ("System", "Type"): 161 case "ArrayField" when field.ContainingType.IsTypeOf ("Mono.Linker.Tests.Cases.DataFlow", "WriteArrayField"): 166 case "Empty" when field.ContainingType.IsTypeOf ("System", "String"): {
Microsoft.Analyzers.Extra (8)
AsyncMethodWithoutCancellation.cs (2)
88if (IsObsoleteSymbol(methodSymbol.ContainingType)) 140var containingType = method.ContainingType;
CallAnalysis\CallAnalyzer.Handlers.cs (1)
41var type = target.ContainingType;
CallAnalysis\CallAnalyzer.Registrar.cs (2)
167if (!_state.Interfaces.TryGetValue(method.ContainingType, out var handlers)) 170_state.Interfaces.Add(method.ContainingType, handlers);
MakeExeTypesInternalAnalyzer.cs (1)
94if (type.DeclaredAccessibility == Accessibility.Public && type.ContainingType == null)
Utilities\SymbolExtensions.cs (2)
63foreach (var iface in method.ContainingType.AllInterfaces) 69var impl = method.ContainingType.FindImplementationForInterfaceMember(member);
Microsoft.Analyzers.Local (7)
CallAnalysis\CallAnalyzer.Handlers.cs (1)
41var type = target.ContainingType;
CallAnalysis\CallAnalyzer.Registrar.cs (2)
167if (!_state.Interfaces.TryGetValue(method.ContainingType, out var handlers)) 170_state.Interfaces.Add(method.ContainingType, handlers);
Utilities\SymbolExtensions.cs (4)
83var container = symbol.ContainingType; 92container = container.ContainingType; 133var container = symbol.ContainingType; 142container = container.ContainingType;
Microsoft.AspNetCore.Analyzers (7)
MiddlewareAnalysis.cs (1)
17public INamedTypeSymbol StartupType => ConfigureMethod.ContainingType;
OptionsAnalysis.cs (1)
17public INamedTypeSymbol StartupType => ConfigureServicesMethod.ContainingType;
OptionsAnalyzer.cs (2)
30property.Property?.ContainingType?.Name != null && 31property.Property.ContainingType.Name.EndsWith("Options", StringComparison.Ordinal))
OptionsItem.cs (1)
16public INamedTypeSymbol OptionsType => Property.ContainingType;
ServicesAnalysis.cs (1)
17public INamedTypeSymbol StartupType => ConfigureServicesMethod.ContainingType;
StartupAnalyzer.cs (1)
44if (!StartupFacts.IsStartupClass(symbols, type) && !SymbolEqualityComparer.Default.Equals(entryPoint?.ContainingType, type))
Microsoft.AspNetCore.Analyzers.Test (1)
ConfigureMethodVisitorTest.cs (1)
86.Select(m => m.ContainingType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + "." + m.Name)
Microsoft.AspNetCore.App.Analyzers (27)
Authorization\AddAuthorizationBuilderAnalyzer.cs (5)
58&& SymbolEqualityComparer.Default.Equals(invocation.TargetMethod.ContainingType, policyServiceCollectionExtensions) 147if (expressionStatementOperation is ISimpleAssignmentOperation { Target: IPropertyReferenceOperation { Property.ContainingType: { } propertyReferenceContainingType } } 153if (expressionStatementOperation is IInvocationOperation { TargetMethod.ContainingType: { } invokedMethodContainingType } 208&& SymbolEqualityComparer.Default.Equals(methodReferenceOperation.Member.ContainingType, authorizationOptionsTypes.AuthorizationOptions)) 215&& SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod.ContainingType, authorizationOptionsTypes.AuthorizationOptions))
Http\HeaderDictionaryAddAnalyzer.cs (1)
49ContainingType:
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
31IsIHeadersDictionaryType(property.ContainingType))
Mvc\DetectOverriddenAuthorizeAttribute.cs (3)
64foreach (var currentClass in actionSymbol.ContainingType.GetTypeHierarchy()) 68if (currentMethod is not null && IsSameSymbol(currentMethod.ContainingType, currentClass)) 74ReportOverriddenAuthorizeAttributeDiagnosticsIfAny(context, authorizeAttributes, currentMethod.ContainingType.Name, currentMethod.Name);
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
60=> SymbolEqualityComparer.Default.Equals(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Components_Rendering_RenderTreeBuilder), targetMethod.ContainingType)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
199if (methodSymbol?.ContainingType is not INamedTypeSymbol typeSymbol ||
RouteEmbeddedLanguage\Infrastructure\RouteUsageDetector.cs (2)
156if (SymbolEqualityComparer.Default.Equals(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_EndpointRouteBuilderExtensions), mapMethodSymbol.ContainingType)) 214if (methodSymbol?.ContainingType is not INamedTypeSymbol typeSymbol)
RouteHandlers\DetectAmbiguousRoutes.cs (6)
97if (SymbolEqualityComparer.Default.Equals(method.ContainingType, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_RoutingEndpointConventionBuilderExtensions))) 109else if (SymbolEqualityComparer.Default.Equals(method.ContainingType, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_AuthorizationEndpointConventionBuilderExtensions))) 113else if (SymbolEqualityComparer.Default.Equals(method.ContainingType, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Http_OpenApiRouteHandlerBuilderExtensions))) 128else if (SymbolEqualityComparer.Default.Equals(method.ContainingType, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_CorsEndpointConventionBuilderExtensions))) 132else if (SymbolEqualityComparer.Default.Equals(method.ContainingType, wellKnownTypes.Get(WellKnownType.Microsoft_Extensions_DependencyInjection_OutputCacheConventionBuilderExtensions))) 136else if (SymbolEqualityComparer.Default.Equals(method.ContainingType, wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_RateLimiterEndpointConventionBuilderExtensions)))
RouteHandlers\RouteHandlerAnalyzer.cs (1)
201SymbolEqualityComparer.Default.Equals(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Builder_EndpointRouteBuilderExtensions), targetMethod.ContainingType) &&
src\Shared\Roslyn\MvcFacts.cs (4)
33if (type.ContainingType != null) 113return method.ContainingType; 136if (method.ExplicitInterfaceImplementations[i].ContainingType.SpecialType == SpecialType.System_IDisposable) 142var implementedMethod = method.ContainingType.FindImplementationForInterfaceMember(disposableDispose);
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
222var constructedType = $"typeof({parameterSymbol.ContainingType.ToDisplayString()})";
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
352if (SymbolEqualityComparer.Default.Equals(type, methodSymbol.ContainingType))
Microsoft.AspNetCore.Components.Analyzers (5)
ComponentParameterAnalyzer.cs (1)
145=> propertySymbol.ContainingType.GetMembers()
ComponentParameterUsageAnalyzer.cs (2)
75var propertyContainingType = componentProperty.ContainingType; 82var assignmentContainingType = startBlockContext.OwningSymbol?.ContainingType;
InternalUsageAnalyzer.cs (2)
144var containingType = symbol.ContainingType; 173var containingType = symbol as INamedTypeSymbol ?? symbol.ContainingType;
Microsoft.AspNetCore.Components.SdkAnalyzers (4)
ComponentParameterUsageAnalyzer.cs (2)
75var propertyContainingType = componentProperty.ContainingType; 82var assignmentContainingType = startBlockContext.OwningSymbol?.ContainingType;
InternalUsageAnalyzer.cs (2)
144var containingType = symbol.ContainingType; 173var containingType = symbol as INamedTypeSymbol ?? symbol.ContainingType;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
222var constructedType = $"typeof({parameterSymbol.ContainingType.ToDisplayString()})";
StaticRouteHandlerModel\EndpointParameter.cs (1)
45var propertyInfo = $"typeof({property.ContainingType.ToDisplayString()})!.GetProperty({SymbolDisplay.FormatLiteral(property.Name, true)})!";
Microsoft.AspNetCore.Mvc.Analyzers (8)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (1)
42var declaringType = method.ContainingType;
src\Shared\Roslyn\MvcFacts.cs (4)
33if (type.ContainingType != null) 113return method.ContainingType; 136if (method.ExplicitInterfaceImplementations[i].ContainingType.SpecialType == SpecialType.System_IDisposable) 142var implementedMethod = method.ContainingType.FindImplementationForInterfaceMember(disposableDispose);
TopLevelParameterNameAnalyzer.cs (2)
51if (!MvcFacts.IsController(method.ContainingType, symbolCache.ControllerAttribute, symbolCache.NonControllerAttribute) || 57if (method.ContainingType.HasAttribute(symbolCache.IApiBehaviorMetadata, inherit: true))
ViewFeaturesAnalyzerContext.cs (1)
35if (!SymbolEqualityComparer.Default.Equals(method.ContainingType, HtmlHelperPartialExtensionsType))
Microsoft.AspNetCore.Mvc.Api.Analyzers (10)
ActualApiResponseMetadataFactory.cs (1)
274var implementedProperty = property.ContainingType.FindImplementationForInterfaceMember(statusCodeActionResultStatusProperty);
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
193if (!SymbolEqualityComparer.Default.Equals(propertyReference.Member.ContainingType, symbolCache.ModelStateDictionary))
ApiControllerFacts.cs (2)
23if (!MvcFacts.IsController(method.ContainingType, symbolCache.ControllerAttribute, symbolCache.NonControllerAttribute)) 28if (!method.ContainingType.HasAttribute(symbolCache.IApiBehaviorMetadata, inherit: true) &&
src\Shared\Roslyn\MvcFacts.cs (4)
33if (type.ContainingType != null) 113return method.ContainingType; 136if (method.ExplicitInterfaceImplementations[i].ContainingType.SpecialType == SpecialType.System_IDisposable) 142var implementedMethod = method.ContainingType.FindImplementationForInterfaceMember(disposableDispose);
SymbolApiResponseMetadataProvider.cs (2)
49method.ContainingType.GetAttributes(symbolCache.ProducesErrorResponseTypeAttribute).FirstOrDefault() ?? 163var attributes = method.ContainingType.GetAttributes(symbolCache.ApiConventionTypeAttribute, inherit: true).ToArray();
Microsoft.CodeAnalysis (21)
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
1699for (var type = symbol.ContainingType; type != null; type = type.ContainingType)
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (6)
526var typeParameter = GetNthTypeParameter(bindingContext.ContainingType, typeParameterIndex); 560for (var containingType = bindingContext.ContainingType; containingType != null; containingType = containingType.ContainingType) 838var containingTypeParameterCount = GetTypeParameterCount(typeSymbol.ContainingType); 841return GetNthTypeParameter(typeSymbol.ContainingType, n); 861return typeSymbol.TypeParameters.Length + GetTypeParameterCount(typeSymbol.ContainingType);
DocumentationCommentId.cs (4)
1001var typeContext = methodContext != null ? methodContext.ContainingType : typeParameterContext as INamedTypeSymbol; 1412var containingTypeParameterCount = GetTypeParameterCount(typeSymbol.ContainingType); 1415return GetNthTypeParameter(typeSymbol.ContainingType, n); 1435return typeSymbol.TypeParameters.Length + GetTypeParameterCount(typeSymbol.ContainingType);
Operations\ControlFlowGraphBuilder.cs (6)
4590collection = applyConversion(inlineArrayConversion, collection, info.GetEnumeratorMethod.ContainingType); 7143operation.Property.ContainingType.IsAnonymousType && 7144operation.Property.ContainingType == _currentImplicitInstance.AnonymousType) 7223operation.Syntax, fieldSymbol.ContainingType, isImplicit: true); 7241operation.Syntax, propertySymbol.ContainingType, isImplicit: true); 7798type: matchFailureCtor.ContainingType, constantValue: null, isImplicit: true);
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (1)
195var type = ctor.ContainingType;
Symbols\ISymbolExtensions.cs (2)
129ContainingType: null, 153!lockType.Equals(scopeType.ContainingType, SymbolEqualityComparer.ConsiderEverything))
Microsoft.CodeAnalysis.CodeStyle (108)
src\Analyzers\Core\Analyzers\Helpers\DeserializationConstructorCheck.cs (1)
23methodSymbol.ContainingType.AllInterfaces.Contains(_iSerializableType);
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (4)
79Equals(_analyzer._equalityComparerType, targetMethod.ContainingType.OriginalDefinition) && 123Equals(_method.ContainingType.BaseType, instanceReference.Type)) 145Equals(fieldOrProp.ContainingType.OriginalDefinition, _method.ContainingType))
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (5)
151if (namedType.ContainingType is { } containingType) 182if (!symbol.IsStatic && symbol.ContainingType.HasAttribute(inlineArrayAttribute)) 194&& symbol.ContainingType.HasAttribute(dataContractAttribute); 272if (!field.ContainingType.Equals(owningSymbol.ContainingType))
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (1)
63_suppressMessageAttributeType.Equals(propertyReference.Property.ContainingType))
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (6)
269if (namedType.ContainingType is { } containingType) 783if (methodSymbol.ContainingType.IsRecord && 786methodSymbol.Parameters[0].Type.Equals(memberSymbol.ContainingType)) 856if (_iNotifyCompletionType != null && Roslyn.Utilities.ImmutableArrayExtensions.Contains(methodSymbol.ContainingType.AllInterfaces, _iNotifyCompletionType, SymbolEqualityComparer.Default) 872if (_iNotifyCompletionType != null && memberSymbol.ContainingType.AllInterfaces.Contains(_iNotifyCompletionType) && memberSymbol.Name == "IsCompleted") 908methodSymbol.ContainingType.GetMembers(suffix).Any(static m => m is IPropertySymbol);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
269if (method.ContainingType is { } containingType)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (5)
127return method.ContainingType.SpecialType == SpecialType.System_Object 144return IsType<CultureInfo>(member.ContainingType, operation.SemanticModel); 148return IsType<NumberFormatInfo>(member.ContainingType, operation.SemanticModel) 149|| IsType<DateTimeFormatInfo>(member.ContainingType, operation.SemanticModel); 166TargetMethod: { Name: nameof(FormattableString.Invariant), ContainingType: var containingType },
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
349if (!containingType.Equals(property.ContainingType))
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (2)
156operation.OperatorMethod.ContainingType.GetMembers(WellKnownMemberNames.IncrementOperatorName).Length > 0) 176operation.OperatorMethod.ContainingType.GetMembers(WellKnownMemberNames.DecrementOperatorName).Length > 0)
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (2)
50if (field.ContainingType.IsTupleType) 54var namedField = GetNamedField(field.ContainingType, field, context.CancellationToken);
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
26ContainingType.OriginalDefinition.SpecialType: SpecialType.System_Nullable_T,
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (1)
179if (member != null && member.ContainingType.IsInterfaceType())
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
297var containingType = symbolInfo.Symbol.ContainingType;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (6)
526var typeParameter = GetNthTypeParameter(bindingContext.ContainingType, typeParameterIndex); 560for (var containingType = bindingContext.ContainingType; containingType != null; containingType = containingType.ContainingType) 838var containingTypeParameterCount = GetTypeParameterCount(typeSymbol.ContainingType); 841return GetNthTypeParameter(typeSymbol.ContainingType, n); 861return typeSymbol.TypeParameters.Length + GetTypeParameterCount(typeSymbol.ContainingType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (7)
45for (var current = symbol; current != null; current = current.ContainingType) 56for (var current = symbol; current != null; current = current.ContainingType) 87if (member.ContainingType.TypeKind == TypeKind.Interface) 158if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 257return implementation != null && Equals(implementation.ContainingType, classOrStructType); 276return implementation != null && Equals(implementation.ContainingType, classOrStructType); 660ContainingType.SpecialType: SpecialType.System_Object,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
32ContainingType: { IsRecord: true } containingType, 64ContainingType: { } containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IPropertySymbolExtensions.cs (1)
12=> property.ContainingType.GetMembers()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (14)
95foreach (var baseType in symbol.ContainingType.GetBaseTypes()) 153foreach (var iface in symbol.ContainingType.AllInterfaces) 157var impl = symbol.ContainingType.FindImplementationForInterfaceMember(interfaceMember); 177return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 184symbol.ContainingType != null && 185symbol.ContainingType.TypeKind == TypeKind.Interface) 221return symbol.ContainingType; 270=> symbol?.Kind == SymbolKind.Field && symbol.ContainingType.IsEnumType(); 282=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 318=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType(); 321=> symbol is IFieldSymbol { ContainingType.IsTupleType: true }; 444symbol = symbol.ContainingType; 463var containingType = symbol.ContainingType; 467containingType = containingType.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (5)
165return IsMemberAccessible(symbol.ContainingType, symbol.DeclaredAccessibility, within, throughType, out failedThroughTypeCheck); 201var containingType = type.ContainingType; 204: IsMemberAccessible(type.ContainingType, type.DeclaredAccessibility, within, null, out _); 398current = current.ContainingType; 444current = current.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (5)
140current = current.ContainingType; 146var current = type.ContainingType; 150current = current.ContainingType; 234b.ContainingType == null && 250&& symbol.ContainingType == null
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (2)
57if (symbol.ContainingType != null) 59accessibility = AccessibilityUtilities.Minimum(accessibility, symbol.ContainingType.Accept(this));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (2)
78var updatedContainingType = symbol.ContainingType?.Accept(this); 81if (!Equals(updatedContainingType, symbol.ContainingType))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
67var containingType = symbol.ContainingType; 89var containingType = symbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (3)
30/// the "same" <see cref="ISymbol.ContainingType"/> and 33/// the "same" <see cref="ISymbol.ContainingType"/>, 59/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (1)
116return reader.ReadSymbolKey(contextualType?.ContainingType, out failureReason);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.EventSymbolKey.cs (2)
16visitor.WriteSymbolKey(symbol.ContainingType); 23var containingTypeResolution = reader.ReadSymbolKey(contextualSymbol?.ContainingType, out var containingTypeFailureReason);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FieldSymbolKey.cs (2)
16visitor.WriteSymbolKey(symbol.ContainingType); 23var containingTypeResolution = reader.ReadSymbolKey(contextualSymbol?.ContainingType, out var containingTypeFailureReason);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (10)
416var type = methodSymbol.ContainingType; 417var newType = newMethodSymbol.ContainingType; 758&& symbol.ContainingType.SpecialType == SpecialType.System_Object 884symbol.ContainingType != null && 885symbol.ContainingType.IsAnonymousType(); 940if (newSymbol.ContainingType.IsDelegateType() && 941symbol.ContainingType.IsDelegateType() && 942IsReferenceConversion(this.OriginalSemanticModel.Compilation, newSymbol.ContainingType, symbol.ContainingType)) 994var newSymbolContainingType = newSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (4)
189if (property1.ContainingType == null || 190property1.ContainingType.TypeKind == TypeKind.Interface) 199if (property2.ContainingType == null || 200property2.ContainingType.TypeKind == TypeKind.Interface)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (1)
200if (x is { MethodKind: MethodKind.DelegateInvoke, ContainingType.IsAnonymousType: true })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (6)
397x.ContainingType == null && 586if (x.ContainingType.IsAnonymousType && y.ContainingType.IsAnonymousType) 619(x.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(x.ContainingType)) || 623(y.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(y.ContainingType)) || 640if (x.TypeParameterKind == TypeParameterKind.Type && x.ContainingType.IsAnonymousType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
263(x.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(x.ContainingType)) || 275if (x.TypeParameterKind == TypeParameterKind.Type && x.ContainingType.IsAnonymousType)
Microsoft.CodeAnalysis.CodeStyle.Fixes (36)
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
52if (symbol.ContainingType?.TypeKind == TypeKind.Interface)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (3)
166IMethodSymbol methodSymbol => methodSymbol.ContainingType, // Implicit object creation expressions 386invocationDocument, argument, method.ContainingType, cancellationToken).ConfigureAwait(false); 394new ParameterName(argumentNameSuggestion, isNamedArgument, tryMakeCamelCase: !method.ContainingType.IsRecord),
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
198constructor.ContainingType,
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (3)
59if (!delegatedConstructor.ContainingType.Equals(currentConstructor.ContainingType)) 64var constructorsCount = delegatedConstructor.ContainingType.InstanceConstructors.Length;
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (2)
228if (TypeToGenerateIn.Equals(constructor.ContainingType) && 437var isThis = _delegatedConstructor.ContainingType.OriginalDefinition.Equals(TypeToGenerateIn.OriginalDefinition);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
84if (baseConstructor.ContainingType.IsAbstractClass() && !classType.IsAbstractClass())
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
380symbol.ContainingType.Equals(ContainingType))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (2)
214if (IsTypeLessAccessibleThanOtherType(first.ContainingType, second, alreadyCheckingTypes)) 236var idisposableType = disposeMethod.ContainingType;
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
170string.Format("{0}_{1}", member.ContainingType.Name, member.Name),
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (1)
60unimplementedMembers.WhereAsArray(m => !m.type.Equals(disposeMethod.ContainingType)),
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
74var containingType = accessesBase ? method!.ContainingType : null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
377return field != null && field.ContainingType.IsEnumType();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
48var type = ctor.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorInfo.cs (1)
84=> info == null ? constructor.ContainingType.Name : info._typeName;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorInfo.cs (1)
52=> info == null ? constructor.ContainingType.Name : info._typeName;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (4)
63method.ContainingType, 89method.ContainingType, 116typeParameter.ContainingType, 164containingType: method.ContainingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (2)
26property.ContainingType, 52property.ContainingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (3)
131member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented) 167explicitlyImplementedProperty.ContainingType, 183var classOrStructType = throughMember.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
448var containingType = property.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (3)
66var containingType = parameter.ContainingType; 84var containingType = parameter.ContainingType; 150memberReference.Member.ContainingType.Equals(containingType))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
123symbol.ContainingType?.SpecialType == SpecialType.System_Enum;
Microsoft.CodeAnalysis.CSharp (29)
SymbolDisplay\SymbolDisplayVisitor.cs (3)
368INamedTypeSymbol containingType = symbol.ContainingType; 466&& symbol.ContainingType != null 467&& symbol.ContainingType.TypeKind == TypeKind.Enum
SymbolDisplay\SymbolDisplayVisitor.Members.cs (22)
56IncludeNamedType(symbol.ContainingType)) 58symbol.ContainingType.Accept(this.NotFirstVisitor); 70else if (symbol.ContainingType.TypeKind == TypeKind.Enum) 99if (property.ContainingType?.IsReadOnly == true) 123if (method.ContainingType?.IsReadOnly == true) 172IncludeNamedType(symbol.ContainingType)) 174symbol.ContainingType.Accept(this.NotFirstVisitor); 254IncludeNamedType(symbol.ContainingType)) 256symbol.ContainingType.Accept(this.NotFirstVisitor); 311if ((object?)symbol.ContainingType != null || (symbol.ContainingSymbol is ITypeSymbol)) 399containingType = symbol.ContainingType; 403includeType = IncludeNamedType(symbol.ContainingType); 473var name = Format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMemberNames) || symbol.ContainingType == null || symbol.ContainingType.IsAnonymousType 475: symbol.ContainingType.Name; 487if (Format.CompilerInternalOptions.IncludesOption(SymbolDisplayCompilerInternalOptions.UseMetadataMemberNames) || symbol.ContainingType == null) 494Builder.Add(CreatePart(partKind, symbol, symbol.ContainingType.Name)); 755if (symbol.ContainingType is null) 760return GetPartKind(symbol.ContainingType); 923INamedTypeSymbol containingType = symbol.ContainingType; 1051Debug.Assert(implementedMember.ContainingType != null); 1053INamedTypeSymbol containingType = implementedMember.ContainingType;
SymbolDisplay\SymbolDisplayVisitor.Types.cs (2)
292if (IncludeNamedType(symbol.ContainingType)) 294symbol.ContainingType.Accept(this.NotFirstVisitor);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
136if (IncludeNamedType(symbol.ContainingType)) 138symbol.ContainingType.Accept(this.NotFirstVisitor);
Microsoft.CodeAnalysis.CSharp.CodeStyle (26)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
87canConvertToTopLevelStatements = TypeCanBeConverted(entryPointMethod.ContainingType, containingTypeDeclaration); 105if (containingType.ContainingType != null)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
394if (methodReference.ContainingType.SpecialType is SpecialType.System_Object or SpecialType.System_ValueType)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
211if (!enumerableType.Equals(castOrSelectSymbol?.OriginalDefinition.ContainingType) || 212!enumerableType.Equals(whereSymbol?.OriginalDefinition.ContainingType))
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
129if (symbolInfo.GetAnySymbol() is not IFieldSymbol { ContainingType.TypeKind: TypeKind.Struct })
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
390if (BannedTypes.Contains(member?.ContainingType.Name))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
82if (!symbol.ContainingType
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
186if (symbol is null || !symbol.IsUserDefinedOperator() || symbol.ContainingType.SpecialType == SpecialType.System_String) 204symbol.ContainingType?.SpecialType == SpecialType.System_Object)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (1)
74var containingType = method.ContainingType;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (2)
305var indexer = GetIndexer(targetMethod.ContainingType, infoCache.RangeType, targetMethod.ContainingType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (3)
110var overloadWithTwoArguments = method.ContainingType 136var containingType = sliceLikeMethod.ContainingType; 161sliceLikeMethod.ContainingType.GetMembers(nameof(Span<int>.Slice))
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (2)
16=> method is { ContainingType.SpecialType: SpecialType.System_String, Name: nameof(string.Remove) }; 148: method.ContainingType.GetMembers(method.Name)
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (2)
394var delegateContainingType = delegateType.ContainingType; 418localEnclosingSymbol = localEnclosingSymbol.ContainingType;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
102if (!namedType.Equals(member.ContainingType)) 215for (var containingType = startSymbol.ContainingType; containingType != null; containingType = containingType.ContainingType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
726if (current.ContainingType.SpecialType == SpecialType.System_Object) 1273if (originalMemberSymbol.ContainingType.TypeKind == TypeKind.Interface) 1321var rewrittenContainingType = rewrittenMemberSymbol.ContainingType;
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (22)
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
65var type = constructorSymbol.ContainingType;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (4)
32var type = methodSymbol.ContainingType; 314var positionalParam = param.ContainingSymbol.ContainingType.GetMembers().FirstOrDefault(member 496var type = methodSymbol.ContainingType; 1103equals.Equals(equals.ContainingType.FindImplementationForInterfaceMember(equatableEquals)))
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
122var memberContainer = matchingMember.ContainingType.ToMinimalDisplayString(semanticModel, span.Start);
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (2)
70var containingTypeVisibility = propertySymbol.ContainingType.GetResultantVisibility(); 80var containingTypeVisibility = fieldSymbol.ContainingType.GetResultantVisibility();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
320INamedTypeSymbol { ContainingType: { } containingType } => CreateDottedName(originalName, currentName, containingType),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
218if (implementation.ContainingType.GenerateTypeSyntax() is not NameSyntax name)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (1)
248if (@event.AddMethod?.IsReadOnly == true && !@event.ContainingType.IsReadOnly)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
115var canUseFieldReference = field.Type != null && !field.Type.Equals(field.ContainingType);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
397if (hasAllReadOnlyAccessors && !property.ContainingType.IsReadOnly)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
107containingType = containingType.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (3)
51if (symbol.ContainingType != null) 53if (symbol.ContainingType.TypeKind == TypeKind.Submission) 59var container = symbol.ContainingType.Accept(this)!;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (3)
273if (symbol.ContainingType != null) 275if (symbol.ContainingType.TypeKind != TypeKind.Submission) 277var containingTypeSyntax = symbol.ContainingType.Accept(this);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (1)
89IsFieldOrPropertyReference(tupleLeft.Elements[i], sibling.ContainingType, out _))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
103var namedType = parameter.ContainingType;
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
EventHookup\EventHookupSessionManager_EventHookupSession.cs (1)
257: eventSymbol.ContainingType.Name;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (17)
CodeGen\CodeGenLocalFunctionTests.cs (15)
2595Assert.Equal(verify.Compilation.GetTypeByMetadataName("Program"), goo.ContainingType); 2613Assert.Equal(program, goo.ContainingType); 2719Assert.Equal(outer.ContainingType, inner.ContainingType); 3134Assert.Equal(program, goo.ContainingType); 3205Assert.Equal(program, inner.ContainingType); 3206Assert.Equal(program, middle.ContainingType); 3207Assert.Equal(program, outer.ContainingType); 3251Assert.Equal(program, verify.FindLocalFunction("First").ContainingType); 3252Assert.Equal(program, verify.FindLocalFunction("Second").ContainingType); 3277Assert.Equal(program, goo.ContainingType); 3312Assert.Equal(program, goo.ContainingType); 3313Assert.Equal(program, bar.ContainingType); 3398Assert.Equal(program, verify.FindLocalFunction("Inner").ContainingType); 4241Assert.Equal(verify.Compilation.GetTypeByMetadataName("Program"), goo.ContainingType);
CodeGen\IndexAndRangeTests.cs (2)
42Assert.Equal(containingTypeName, symbol.ContainingType.Name); 1003Assert.Equal("S", property.ContainingType.Name);
Microsoft.CodeAnalysis.CSharp.Features (71)
ChangeSignature\CSharpChangeSignatureService.cs (1)
877if (Equals(convertedType, symbol.ContainingType))
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
318reservedNames: declaredSymbol.ContainingType.GetMembers().Select(m => m.Name));
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
525ContainingType: not { SpecialType: SpecialType.System_Nullable_T }
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
303containingType.Equals(symbol.ContainingType))
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (1)
72var symbols = ImmutableArray.Create<ISymbol>(conversion.ContainingType, conversion.Parameters.First().Type, conversion.ReturnType);
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (2)
43return NameGenerator.GenerateUniqueName(fieldName, n => !(property.ContainingType.Name == n || property.ContainingType.GetMembers(n).Any()));
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
249TypeSymbolIsList(methodSymbol.ContainingType, semanticModel) &&
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
76var programType = mainMethod.ContainingType;
DecompiledSource\CSharpDecompiledSourceService.cs (2)
114symbol = (INamespaceOrTypeSymbol?)symbol.ContainingType ?? symbol.ContainingNamespace) 116if (symbol.ContainingType is not null)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (9)
959if (GetPrimaryConstructor(method.ContainingType, cancellationToken) is { } primaryConstructor) 965if (method.ContainingType.IsRecord && method.IsCopyConstructor()) 974return method.ContainingType.TypeKind != TypeKind.Struct; 978if (method.ContainingType.TypeKind == TypeKind.Struct) 1007ContainingType.IsRecord: true, 1129var oldSynthesizedAutoProperty = (IPropertySymbol?)oldSymbol?.ContainingType.GetMembers(oldSymbol.Name).FirstOrDefault(m => m.IsSynthesizedAutoProperty()); 1130var newSynthesizedAutoProperty = (IPropertySymbol?)newSymbol?.ContainingType.GetMembers(newSymbol.Name).FirstOrDefault(m => m.IsSynthesizedAutoProperty()); 2549{ ContainingType.TypeKind: TypeKind.Interface } 2554IFieldSymbol { ContainingType.TypeKind: TypeKind.Enum }
EncapsulateField\CSharpEncapsulateFieldService.cs (5)
109field.ContainingType, 161return (field.Name, MakeUnique(GeneratePropertyName(field.Name), field.ContainingType)); 171return (MakeUnique(GenerateFieldName(field.Name), field.ContainingType), newPropertyName); 175newPropertyName = MakeUnique(newPropertyName, field.ContainingType); 185return (MakeUnique(newFieldName, field.ContainingType), newPropertyName);
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (2)
58var containingType = property.ContainingType; 72return property.ContainingType.GetMembers(accessedMemberName).FirstOrDefault() as IFieldSymbol;
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
197containingType.Equals(impl.ContainingType) &&
ImplementInterface\CSharpImplementImplicitlyCodeRefactoringProvider.cs (1)
38var containingTypeInterfaces = member.ContainingType.AllInterfaces;
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (1)
275foreach (var group in parameter.ContainingType.DeclaringSyntaxReferences.GroupBy(r => r.SyntaxTree))
NavigationBar\CSharpNavigationBarItemService.cs (1)
213return symbol.ContainingType.TypeKind == TypeKind.Enum
SignatureHelp\AttributeSignatureHelpProvider.cs (2)
138var namedParameters = constructor.ContainingType.GetAttributeNamedParameters(semanticModel.Compilation, within) 221return [.. method.ContainingType.ToMinimalDisplayParts(semanticModel, position), Punctuation(SyntaxKind.OpenParenToken)];
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (1)
157return [.. method.ContainingType.ToMinimalDisplayParts(semanticModel, position), Punctuation(SyntaxKind.OpenParenToken)];
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (1)
262result.AddRange(indexer.ContainingType.ToMinimalDisplayParts(semanticModel, position));
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_DelegateAndFunctionPointerInvoke.cs (1)
71displayParts.AddRange(invokeMethod.ContainingType.ToMinimalDisplayParts(semanticModel, position));
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs (1)
40result.AddRange(invokeMethod.ContainingType.ToMinimalDisplayParts(semanticModel, position));
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_NormalType.cs (1)
46result.AddRange(method.ContainingType.ToMinimalDisplayParts(semanticModel, position));
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (1)
146result.AddRange(method.ContainingType.ToMinimalDisplayParts(semanticModel, position));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (2)
87canConvertToTopLevelStatements = TypeCanBeConverted(entryPointMethod.ContainingType, containingTypeDeclaration); 105if (containingType.ContainingType != null)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
394if (methodReference.ContainingType.SpecialType is SpecialType.System_Object or SpecialType.System_ValueType)
src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
211if (!enumerableType.Equals(castOrSelectSymbol?.OriginalDefinition.ContainingType) || 212!enumerableType.Equals(whereSymbol?.OriginalDefinition.ContainingType))
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (1)
129if (symbolInfo.GetAnySymbol() is not IFieldSymbol { ContainingType.TypeKind: TypeKind.Struct })
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
390if (BannedTypes.Contains(member?.ContainingType.Name))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
82if (!symbol.ContainingType
src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (2)
186if (symbol is null || !symbol.IsUserDefinedOperator() || symbol.ContainingType.SpecialType == SpecialType.System_String) 204symbol.ContainingType?.SpecialType == SpecialType.System_Object)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (1)
74var containingType = method.ContainingType;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (2)
305var indexer = GetIndexer(targetMethod.ContainingType, infoCache.RangeType, targetMethod.ContainingType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (3)
110var overloadWithTwoArguments = method.ContainingType 136var containingType = sliceLikeMethod.ContainingType; 161sliceLikeMethod.ContainingType.GetMembers(nameof(Span<int>.Slice))
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (2)
16=> method is { ContainingType.SpecialType: SpecialType.System_String, Name: nameof(string.Remove) }; 148: method.ContainingType.GetMembers(method.Name)
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (2)
394var delegateContainingType = delegateType.ContainingType; 418localEnclosingSymbol = localEnclosingSymbol.ContainingType;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
102if (!namedType.Equals(member.ContainingType)) 215for (var containingType = startSymbol.ContainingType; containingType != null; containingType = containingType.ContainingType)
src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
65var type = constructorSymbol.ContainingType;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (4)
32var type = methodSymbol.ContainingType; 314var positionalParam = param.ContainingSymbol.ContainingType.GetMembers().FirstOrDefault(member 496var type = methodSymbol.ContainingType; 1103equals.Equals(equals.ContainingType.FindImplementationForInterfaceMember(equatableEquals)))
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
122var memberContainer = matchingMember.ContainingType.ToMinimalDisplayString(semanticModel, span.Start);
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (2)
70var containingTypeVisibility = propertySymbol.ContainingType.GetResultantVisibility(); 80var containingTypeVisibility = fieldSymbol.ContainingType.GetResultantVisibility();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
320INamedTypeSymbol { ContainingType: { } containingType } => CreateDottedName(originalName, currentName, containingType),
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (14)
Semantics\InteractiveUsingTests.cs (3)
193Assert.Equal(((Compilation)sub3).ScriptClass, GetSpeculativeType(sub3, "A").ContainingType); 215Assert.Equal(sub.ScriptClass.GetMember("Type"), GetSpeculativeSymbol(sub, "Field").ContainingType); 234Assert.Equal(typeSymbol, GetSpeculativeSymbol(sub4, "CC").ContainingType);
Semantics\LocalFunctionTests.cs (2)
1064Assert.Equal("A", attrConstructor.ContainingType.Name); 10183Assert.Equal("MyAttribute", property.ContainingType.Name);
Semantics\NativeIntegerTests.cs (1)
539Assert.Same(type, member.ContainingType);
Semantics\OperatorTests.cs (8)
7630expectChecked = (type.IsDynamic() || symbol1.ContainingType.EnumUnderlyingTypeOrSelf().SpecialType.IsIntegralType()); 7638symbol1.ContainingType.EnumUnderlyingTypeOrSelf().SpecialType.IsIntegralType() || 7639symbol1.ContainingType.SpecialType == SpecialType.System_Char); 8408isChecked = isDynamic || symbol1.ContainingSymbol.Kind == SymbolKind.PointerType || symbol1.ContainingType.EnumUnderlyingTypeOrSelf().SpecialType.IsIntegralType(); 8644Assert.Null(symbol1.ContainingType); 8655Assert.Null(symbol2.ContainingType); 8694Assert.Null(symbol1.ContainingType); 8705Assert.Null(symbol2.ContainingType);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (59)
Compilation\SemanticModelAPITests.cs (3)
1368Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), symbol.ContainingType); 2084Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), symbol.ContainingType); 2101Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), symbol.ContainingType);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (8)
1387Assert.Equal(9, symbolsInC.Where(s => s.ContainingType == null || s.ContainingType.SpecialType != SpecialType.System_Object).Count()); 1391Assert.True(symbolsInC.Any(s => s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "A")); 1392Assert.True(symbolsInC.Any(s => s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "B")); 1393Assert.True(symbolsInC.Any(s => s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "C")); 1394Assert.True(symbolsInC.Any(s => s.Name == "F" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "C")); 3645Assert.Equal(enumTypeSymbol, symbol.ContainingType); 3649Assert.Equal(enumTypeSymbol, fSymbol.ContainingType);
Compilation\SemanticModelGetSemanticInfoTests.cs (1)
9280var a = type.ContainingType;
DocumentationComments\CrefTests.cs (1)
5720Assert.Equal(SpecialType.System_Decimal, symbol.ContainingType.SpecialType);
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (2)
1038Assert.Equal(classDisposable, methodDispose.ContainingType); 1052var type = methodSymbol.ContainingType;
Symbols\ConversionTests.cs (2)
2145Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), method.ContainingType); 2179Assert.Equal(comp.GlobalNamespace.GetMember<INamedTypeSymbol>("C"), method.ContainingType);
Symbols\Source\NullablePublicAPITests.cs (20)
2742Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2743Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2747Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2748Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2788Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2789Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2793Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2794Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2831Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2832Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2836Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2837Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2880Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2881Assert.Equal(PublicNullableAnnotation.Annotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 2885Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations[0]); 2886Assert.Equal(PublicNullableAnnotation.NotAnnotated, symInfo.Symbol.ContainingType.TypeArgumentNullableAnnotations().First()); 3413Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations[0]); 3414Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations().First()); 3458Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations[0]); 3459Assert.Equal(annotation, method.ContainingType.TypeArgumentNullableAnnotations().First());
Symbols\Source\TypeMapTests.cs (7)
61Assert.Equal(atbu, c.ContainingType); 62Assert.Equal(u, TypeArg(c.ContainingType)); 63Assert.Equal(at, c.ContainingType.ContainingType); 64Assert.Equal(t, TypeArg(c.ContainingType.ContainingType)); 73Assert.Equal(top, bf.ContainingType);
Symbols\StaticAbstractMembersInInterfacesTests.cs (5)
19567Assert.DoesNotContain(opName, declaredSymbol.ContainingType.MemberNames); 19650Assert.DoesNotContain(opName, declaredSymbol.ContainingType.MemberNames); 19742Assert.DoesNotContain(opName, declaredSymbol.ContainingType.MemberNames); 19831Assert.DoesNotContain(opName, declaredSymbol.ContainingType.MemberNames); 28780Assert.DoesNotContain(opName, declaredSymbol.ContainingType.MemberNames);
Symbols\SymbolEqualityTests.cs (8)
170var nonNullSubstituted = nonNullM.ContainingType.GetMembers("M").Single(); 171var nullSubstituted = nullM.ContainingType.GetMembers("M").Single(); 795var field1ContainingType = field1.ContainingType; //A<T> 796var field2ContainingType = field2.ContainingType; //A<T!> 853var method1ContainingType = method1.ContainingType; //A<T> 854var method2ContainingType = method2.ContainingType; //A<T!> 907var event1ContainingType = event1.ContainingType; //A<T> 908var event2ContainingType = event2.ContainingType; //A<T!>
Symbols\TypeTests.cs (2)
1861Assert.False(symbol.ContainingType.IsUnboundGenericType); 1862Assert.IsType<UnboundArgumentErrorTypeSymbol>(symbol.ContainingType.TypeArguments.Single().GetSymbol());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (3)
Extensions.cs (2)
209if (!primaryConstructor.ContainingType.IsRecord) 214return primaryConstructor.ContainingType.GetMembers("Deconstruct").OfType<IMethodSymbol>().Single(
TestAttributesVisitor.cs (1)
211var containingType = attribute.AttributeConstructor!.ContainingType;
Microsoft.CodeAnalysis.CSharp.Workspaces (42)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (2)
238return fieldSymbol.ContainingType.IsEnumType() ? ClassificationTypeNames.EnumMemberName : ClassificationTypeNames.ConstantName; 258return methodSymbol.ContainingType?.GetClassification() ?? ClassificationTypeNames.MethodName;
CodeGeneration\CSharpSyntaxGenerator.cs (2)
372=> SyntaxFactory.DestructorDeclaration(destructorMethod.ContainingType.Name).WithBody(SyntaxFactory.Block()); 1804=> SyntaxFactory.ExplicitInterfaceSpecifier(explicitInterfaceImplementations[0].ContainingType.GenerateNameSyntax());
Recommendations\CSharpRecommendationServiceRunner.cs (3)
396!Equals(enclosingNamedType, symbol.ContainingType) && 397!outerTypes.Contains(symbol.ContainingType)) 872symbol.ContainingType.SpecialType is SpecialType.System_Object or SpecialType.System_ValueType)
Recommendations\CSharpRecommendationServiceRunner_Conversions.cs (1)
195method.ContainingType,
Rename\CSharpRenameRewriterLanguageService.cs (4)
909if (renamedSymbol.ContainingType != null && renamedSymbol.ContainingType.GetMembers(renamedSymbol.Name).Contains(renamedSymbol)) 911var conflictingLocations = renamedSymbol.ContainingType.TypeParameters 1036var baseType = renamedSymbol.ContainingType?.GetBaseTypes().FirstOrDefault();
Simplification\CSharpSimplificationService.Expander.cs (10)
589if (symbol.IsConstructor() && symbol.ContainingType?.IsAttribute() == true) 591symbol = symbol.ContainingType; 645symbol = symbol.ContainingType; 691if (!Equals(_semanticModel.GetEnclosingNamedType(originalSimpleName.SpanStart, _cancellationToken), symbol.ContainingType)) 910if (replaceNode || symbol.ContainingType != null || symbol.ContainingNamespace != null) 914if (!replaceNode && symbol.ContainingType == null && symbol.ContainingNamespace.IsGlobalNamespace) 933: (symbol.ContainingType ?? (ISymbol)symbol.ContainingNamespace); 1036type = type.ContainingType; 1098var containingTypeString = reducedExtensionMethod.ContainingType.ToDisplayString(s_typeNameFormatWithGenerics); 1104if (newContainingType == null || !newContainingType.Equals(reducedExtensionMethod.ContainingType))
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (1)
93symbol = symbol.ContainingType;
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
423if (rightSymbol.ContainingType is { TypeArguments.Length: 0 } containingType &&
Simplification\Simplifiers\NameSimplifier.cs (2)
82symbol = method.ContainingType; 724symbol = symbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (3)
726if (current.ContainingType.SpecialType == SpecialType.System_Object) 1273if (originalMemberSymbol.ContainingType.TypeKind == TypeKind.Interface) 1321var rewrittenContainingType = rewrittenMemberSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
218if (implementation.ContainingType.GenerateTypeSyntax() is not NameSyntax name)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (1)
248if (@event.AddMethod?.IsReadOnly == true && !@event.ContainingType.IsReadOnly)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (1)
115var canUseFieldReference = field.Type != null && !field.Type.Equals(field.ContainingType);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (1)
397if (hasAllReadOnlyAccessors && !property.ContainingType.IsReadOnly)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
107containingType = containingType.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (3)
51if (symbol.ContainingType != null) 53if (symbol.ContainingType.TypeKind == TypeKind.Submission) 59var container = symbol.ContainingType.Accept(this)!;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (3)
273if (symbol.ContainingType != null) 275if (symbol.ContainingType.TypeKind != TypeKind.Submission) 277var containingTypeSyntax = symbol.ContainingType.Accept(this);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (1)
89IsFieldOrPropertyReference(tupleLeft.Elements[i], sibling.ContainingType, out _))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
103var namedType = parameter.ContainingType;
Microsoft.CodeAnalysis.EditorFeatures (2)
Navigation\AbstractDefinitionLocationService.cs (1)
295: symbolToNavigateTo.ContainingType;
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
241((IFieldSymbol)sourceSymbol).ContainingType.IsTupleType &&
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
PullMemberUp\TestPullMemberUpService.cs (1)
31var containingType = selectedNodeSymbols[0].ContainingType;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
SymbolFinder\FindSymbolAtPositionTests.cs (1)
62Assert.Equal(TypeKind.Enum, fieldSymbol.ContainingType.TypeKind);
Microsoft.CodeAnalysis.Features (143)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.State.cs (1)
49ContainingType = selectedMembers[0].ContainingType;
ChangeSignature\AbstractChangeSignatureService.cs (4)
116var containingType = method.ContainingType; 313symbolWithSyntacticParameters = methodSymbol.ContainingType; 317methodSymbol.ContainingType != null && 318methodSymbol.ContainingType.IsDelegateType())
ChangeSignature\DelegateInvokeMethodReferenceFinder.cs (2)
48var beginInvoke = symbol.ContainingType.GetMembers(WellKnownMemberNames.DelegateBeginInvokeName).FirstOrDefault(); 115if (convertedType == methodSymbol.ContainingType)
Completion\Providers\AbstractContextVariableArgumentProvider.cs (1)
97if (enclosingSymbol is IMethodSymbol { ContainingType: { } containingType })
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
100fieldOrProperty.ContainingType.IsAnonymousType ||
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
62if (symbol.ContainingType?.SpecialType == SpecialType.System_Object)
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (2)
58var fields = propertySymbol.ContainingType.GetMembers().OfType<IFieldSymbol>(); 107var typeDeclaration = propertySymbol.ContainingType.DeclaringSyntaxReferences;
ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs (2)
245if (symbol?.ContainingType.SpecialType == SpecialType.System_Object) 294ContainingType.SpecialType: SpecialType.System_String,
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
103var shouldReplaceInvocation = invocationSymbol is { ContainingType.SpecialType: SpecialType.System_String, Name: nameof(string.Format) };
Debugging\AbstractBreakpointResolver.cs (1)
188container = ((INamespaceOrTypeSymbol)container.ContainingType) ?? container.ContainingNamespace;
Debugging\AbstractDataTipInfoGetter.cs (4)
48ContainingType.Name: nameof(Enumerable), 49ContainingType.ContainingNamespace.Name: nameof(System.Linq), 50ContainingType.ContainingNamespace.ContainingNamespace.Name: nameof(System), 51ContainingType.ContainingNamespace.ContainingNamespace.ContainingNamespace.IsGlobalNamespace: true,
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (2)
303return (symbol is IParameterSymbol { ContainingType: not { TypeKind: TypeKind.Delegate } }) 351=> symbol.IsConst ? ((symbol.ContainingType.TypeKind == TypeKind.Enum) ? FeaturesResources.enum_value : FeaturesResources.const_field) :
EditAndContinue\SemanticEditInfo.cs (2)
64var partialType = symbol.IsPartialImplementation() ? SymbolKey.Create(symbol.ContainingType, cancellationToken) : (SymbolKey?)null; 74var partialType = symbol.IsPartialImplementation() ? SymbolKey.Create(symbol.ContainingType, cancellationToken) : (SymbolKey?)null;
EditAndContinue\Utilities\Extensions.cs (6)
164=> parameter.IsImplicitlyDeclared || parameter.ContainingSymbol.IsSynthesized() && parameter.ContainingSymbol != parameter.ContainingType.DelegateInvokeMethod; 170=> property.ContainingType.GetMembers().Any(static (member, property) => member is IFieldSymbol field && field.AssociatedSymbol == property, property); 173=> !type.InstanceConstructors.Any(static c => !(c.Parameters is [] || c.ContainingType.IsRecord && c.IsCopyConstructor())); 176=> symbol is IMethodSymbol { Parameters: [var parameter] } && SymbolEqualityComparer.Default.Equals(parameter.Type, symbol.ContainingType); 187=> (IFieldSymbol?)parameter.ContainingType.GetMembers().FirstOrDefault( 207=> (IMethodSymbol?)constructor.ContainingType.GetMembers(WellKnownMemberNames.DeconstructMethodName).FirstOrDefault(
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (1)
152IsDateTimeType(method.ContainingType) &&
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexLanguageDetector.cs (1)
153regexType.Equals(method.ContainingType))
EncapsulateField\AbstractEncapsulateFieldService.cs (4)
214field.ContainingType, 243var constructorLocations = GetConstructorLocations(solution, field.ContainingType); 255constructorLocations = GetConstructorLocations(solution, field.ContainingType); 331var destination = field.ContainingType;
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (3)
153var typeSymbol = symbol.ContainingType; 172=> EnqueueWorkItemAsync(document, symbol.ContainingType != null ? symbol.ContainingType.Locations : symbol.Locations);
ExtractMethod\MethodExtractor.Analyzer.cs (2)
714parameter.ContainingSymbol.ContainingType != null && 715parameter.ContainingSymbol.ContainingType.IsScriptClass;
FindUsages\DefinitionItemFactory.cs (1)
273rqName = RQNameInternal.From(definition.ContainingType);
FindUsages\FindUsagesHelpers.cs (1)
19=> symbol.IsConstructor() ? symbol.ContainingType.Name : symbol.Name;
GoToBase\AbstractGoToBaseService.cs (2)
22var baseType = constructor.ContainingType.BaseType; 27baseConstructor => baseConstructor.IsAccessibleWithin(constructor.ContainingType) &&
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (2)
302return targetMethod.ContainingType.SpecialType == SpecialType.System_String; 508var containingType = parameter.ContainingType;
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (6)
289var defaultAccessibility = DetermineDefaultFieldAccessibility(parameter.ContainingType); 477if (fieldOrProperty.ContainingType is not null) 530var currentFieldOrProperty = currentParameter?.ContainingType 578var containingType = parameter.ContainingType; 620var containingType = parameter.ContainingType; 674if (IsFieldOrPropertyAssignment(statement, member.ContainingType, out var assignmentExpression) &&
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
83methodSymbol.ContainingType.TypeKind == TypeKind.Interface)
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (1)
448: CodeGenerationSymbolFactory.CreateMethodSymbol(_methodSymbol, statements: [newStatement], containingType: _methodSymbol.ContainingType);
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.cs (4)
167if (n1.Equals(property.ContainingType) && !n2.Equals(property.ContainingType)) 171else if (!n1.Equals(property.ContainingType) && n2.Equals(property.ContainingType))
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (2)
544if (symbol.ContainingType != null && symbol.ContainingType.TypeKind == TypeKind.Enum)
MetadataAsSource\AbstractMetadataAsSourceService.AbstractWrappedSymbol.cs (1)
39public INamedTypeSymbol ContainingType => _symbol.ContainingType;
PullMemberUp\MembersPuller.cs (1)
520var implementationOfMember = selectedMember.ContainingType.FindImplementationForInterfaceMember(interfaceMember);
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (4)
64n => !methodSymbol.ContainingType.GetMembers(n).Any()) 98var containingType = getMethod.ContainingType; 112getMethod.ContainingType != null && 125if (current.ContainingType.SpecialType == SpecialType.System_Object)
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (3)
44return propertyBackingField.ContainingType == null 47generator.TypeExpression(propertyBackingField.ContainingType), 325? Generator.TypeExpression(_property.ContainingType)
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (3)
137property.ContainingType.GetMembers(GetPrefix + name) 146property.ContainingType 170n => !property.ContainingType.GetMembers(n).Any());
RQName\RQNodeBuilder.cs (10)
79for (var currentType = type; currentType != null; currentType = currentType.ContainingType) 89var containingType = BuildUnconstructedNamedType(symbol.ContainingType); 112var interfaceType = BuildType(symbol.ExplicitInterfaceImplementations.Single().ContainingType); 122var containingType = BuildUnconstructedNamedType(symbol.ContainingType); 171var containingType = BuildUnconstructedNamedType(symbol.ContainingType); 187var interfaceType = BuildType(symbol.ExplicitInterfaceImplementations.Single().ContainingType); 232var interfaceType = BuildType(symbol.ExplicitInterfaceImplementations.Single().ContainingType); 240var containingType = BuildUnconstructedNamedType(symbol.ContainingType); 312while (type.ContainingType != null) 314type = type.ContainingType;
Shared\Extensions\ISymbolExtensions_2.cs (1)
39var containingType = symbol.ContainingType;
Shared\Utilities\ExtractTypeHelpers.cs (3)
173currentType = currentType.ContainingType; 237if (type.ContainingType != null && 239DoesTypeReferenceTypeParameter(type.ContainingType, typeParameter, checkedTypes))
src\Analyzers\Core\Analyzers\Helpers\DeserializationConstructorCheck.cs (1)
23methodSymbol.ContainingType.AllInterfaces.Contains(_iSerializableType);
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (4)
79Equals(_analyzer._equalityComparerType, targetMethod.ContainingType.OriginalDefinition) && 123Equals(_method.ContainingType.BaseType, instanceReference.Type)) 145Equals(fieldOrProp.ContainingType.OriginalDefinition, _method.ContainingType))
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (5)
151if (namedType.ContainingType is { } containingType) 182if (!symbol.IsStatic && symbol.ContainingType.HasAttribute(inlineArrayAttribute)) 194&& symbol.ContainingType.HasAttribute(dataContractAttribute); 272if (!field.ContainingType.Equals(owningSymbol.ContainingType))
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (1)
63_suppressMessageAttributeType.Equals(propertyReference.Property.ContainingType))
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (6)
269if (namedType.ContainingType is { } containingType) 783if (methodSymbol.ContainingType.IsRecord && 786methodSymbol.Parameters[0].Type.Equals(memberSymbol.ContainingType)) 856if (_iNotifyCompletionType != null && Roslyn.Utilities.ImmutableArrayExtensions.Contains(methodSymbol.ContainingType.AllInterfaces, _iNotifyCompletionType, SymbolEqualityComparer.Default) 872if (_iNotifyCompletionType != null && memberSymbol.ContainingType.AllInterfaces.Contains(_iNotifyCompletionType) && memberSymbol.Name == "IsCompleted") 908methodSymbol.ContainingType.GetMembers(suffix).Any(static m => m is IPropertySymbol);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
269if (method.ContainingType is { } containingType)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (5)
127return method.ContainingType.SpecialType == SpecialType.System_Object 144return IsType<CultureInfo>(member.ContainingType, operation.SemanticModel); 148return IsType<NumberFormatInfo>(member.ContainingType, operation.SemanticModel) 149|| IsType<DateTimeFormatInfo>(member.ContainingType, operation.SemanticModel); 166TargetMethod: { Name: nameof(FormattableString.Invariant), ContainingType: var containingType },
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
349if (!containingType.Equals(property.ContainingType))
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (2)
156operation.OperatorMethod.ContainingType.GetMembers(WellKnownMemberNames.IncrementOperatorName).Length > 0) 176operation.OperatorMethod.ContainingType.GetMembers(WellKnownMemberNames.DecrementOperatorName).Length > 0)
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (2)
50if (field.ContainingType.IsTupleType) 54var namedField = GetNamedField(field.ContainingType, field, context.CancellationToken);
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
26ContainingType.OriginalDefinition.SpecialType: SpecialType.System_Nullable_T,
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (1)
179if (member != null && member.ContainingType.IsInterfaceType())
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
297var containingType = symbolInfo.Symbol.ContainingType;
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
52if (symbol.ContainingType?.TypeKind == TypeKind.Interface)
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (3)
166IMethodSymbol methodSymbol => methodSymbol.ContainingType, // Implicit object creation expressions 386invocationDocument, argument, method.ContainingType, cancellationToken).ConfigureAwait(false); 394new ParameterName(argumentNameSuggestion, isNamedArgument, tryMakeCamelCase: !method.ContainingType.IsRecord),
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
198constructor.ContainingType,
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (3)
59if (!delegatedConstructor.ContainingType.Equals(currentConstructor.ContainingType)) 64var constructorsCount = delegatedConstructor.ContainingType.InstanceConstructors.Length;
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (2)
228if (TypeToGenerateIn.Equals(constructor.ContainingType) && 437var isThis = _delegatedConstructor.ContainingType.OriginalDefinition.Equals(TypeToGenerateIn.OriginalDefinition);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (1)
84if (baseConstructor.ContainingType.IsAbstractClass() && !classType.IsAbstractClass())
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
380symbol.ContainingType.Equals(ContainingType))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (2)
214if (IsTypeLessAccessibleThanOtherType(first.ContainingType, second, alreadyCheckingTypes)) 236var idisposableType = disposeMethod.ContainingType;
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
170string.Format("{0}_{1}", member.ContainingType.Name, member.Name),
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_DisposePattern.cs (1)
60unimplementedMembers.WhereAsArray(m => !m.type.Equals(disposeMethod.ContainingType)),
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
74var containingType = accessesBase ? method!.ContainingType : null;
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (6)
526var typeParameter = GetNthTypeParameter(bindingContext.ContainingType, typeParameterIndex); 560for (var containingType = bindingContext.ContainingType; containingType != null; containingType = containingType.ContainingType) 838var containingTypeParameterCount = GetTypeParameterCount(typeSymbol.ContainingType); 841return GetNthTypeParameter(typeSymbol.ContainingType, n); 861return typeSymbol.TypeParameters.Length + GetTypeParameterCount(typeSymbol.ContainingType);
StackTraceExplorer\StackTraceExplorerUtilities.cs (1)
98symbol = method.ContainingType;
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
368var constructorSpans = field.ContainingType.GetMembers()
Microsoft.CodeAnalysis.Scripting (1)
ScriptBuilder.cs (1)
191string entryPointTypeName = MetadataHelpers.BuildQualifiedName(entryPoint.ContainingNamespace.MetadataName, entryPoint.ContainingType.MetadataName);
Microsoft.CodeAnalysis.Test.Utilities (16)
Compilation\ControlFlowGraphVerifier.cs (4)
909Constructor.ContainingType: INamedTypeSymbol ctorContainingType, 934TargetMethod: { Name: BoundInterpolatedString.AppendFormattedMethod or BoundInterpolatedString.AppendLiteralMethod, ContainingType: INamedTypeSymbol containingType } 1995ContainingType: INamedTypeSymbol 1998ContainingType: null,
Diagnostics\BoxingOperationAnalyzer.cs (1)
64invocation.TargetMethod.ContainingType.IsReferenceType)
Diagnostics\CommonDiagnosticAnalyzers.cs (9)
1579sortedCallbackOperationBlockStartNames.Add($"{context.OwningSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})"); 1582sortedCallbackOperationNames.Add($"{context.ContainingSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})"), 1586sortedCallbackOperationBlockEndNames.Add($"{context.OwningSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})")); 1597sortedCallbackOperationBlockNames.Add($"{context.OwningSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})"); 1611sortedCallbackCodeBlockStartNames.Add($"{context.OwningSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})"); 1614sortedCallbackCodeBlockEndNames.Add($"{context.OwningSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})")); 1624sortedCallbackCodeBlockNames.Add($"{context.OwningSymbol.ContainingType.Name}(IsGeneratedCode:{context.IsGeneratedCode})"); 2119if (symbolEnded.ContainingType != null) 2121containersToVerify.Add(symbolEnded.ContainingType);
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (2)
49ITypeSymbol staticConstructorType = containingMethod.MethodKind == MethodKind.StaticConstructor ? containingMethod.ContainingType : null; 127if (staticConstructorType != null && targetField.IsStatic && targetField.ContainingType == staticConstructorType)
Microsoft.CodeAnalysis.VisualBasic (13)
Operations\VisualBasicOperationFactory.vb (1)
1626propertySym.ContainingType,
SymbolDisplay\SymbolDisplayVisitor.Members.vb (5)
29If symbol.ContainingType.TypeKind = TypeKind.Enum Then 98If Format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) AndAlso IncludeNamedType(symbol.ContainingType) Then 99symbol.ContainingType.Accept(Me.NotFirstVisitor) 134If Format.MemberOptions.IncludesOption(SymbolDisplayMemberOptions.IncludeContainingType) AndAlso IncludeNamedType(symbol.ContainingType) Then 135symbol.ContainingType.Accept(Me.NotFirstVisitor)
SymbolDisplay\SymbolDisplayVisitor.Types.vb (1)
159Dim containingType = symbol.ContainingType
SymbolDisplay\SymbolDisplayVisitor.vb (3)
346Dim containingType = symbol.ContainingType 395symbol.ContainingType IsNot Nothing AndAlso 396symbol.ContainingType.TypeKind = TypeKind.Enum AndAlso
SymbolDisplay\SymbolDisplayVisitor_Minimal.vb (2)
100If IncludeNamedType(symbol.ContainingType) Then 101symbol.ContainingType.Accept(NotFirstVisitor)
Symbols\Symbol.vb (1)
1223Private ReadOnly Property ISymbol_ContainingType As INamedTypeSymbol Implements ISymbol.ContainingType
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (15)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\FieldGenerator.vb (1)
96Dim canUseFieldReference = field.Type IsNot Nothing AndAlso Not field.Type.Equals(field.ContainingType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationHelpers.vb (2)
68If explicitInterfaceOpt IsNot Nothing AndAlso explicitInterfaceOpt.ContainingType IsNot Nothing Then 69Dim type = explicitInterfaceOpt.ContainingType.GenerateTypeSyntax()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxGeneratorVisitor.vb (3)
39If symbol.ContainingType IsNot Nothing Then 40If symbol.ContainingType.TypeKind = TypeKind.Submission Then 43Dim container = symbol.ContainingType.Accept(Me)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\SymbolExtensions.vb (2)
35Dim containingType = symbol.ContainingType 37containingType.ContainingType IsNot Nothing OrElse
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (3)
159If symbol.ContainingType IsNot Nothing Then 160If symbol.ContainingType.TypeKind = TypeKind.Submission Then 163Return AddInformationTo(SyntaxFactory.QualifiedName(DirectCast(symbol.ContainingType.Accept(Me), NameSyntax), simpleNameSyntax), symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\SymbolExtensions.vb (4)
17If propertySymbol.ContainingType IsNot Nothing AndAlso 18propertySymbol.ContainingType.Name = "MyForms" AndAlso 19propertySymbol.ContainingType.ContainingNamespace IsNot Nothing AndAlso 20propertySymbol.ContainingType.ContainingNamespace.IsMyNamespace(compilation) Then
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (1)
EndConstructGeneration\EndConstructStatementVisitor.vb (1)
134If boundConstructor.ContainingType.IsDesignerGeneratedTypeWithInitializeComponent(_semanticModel.Compilation) Then
Microsoft.CodeAnalysis.VisualBasic.Features (27)
ChangeSignature\VisualBasicChangeSignatureService.vb (2)
708If Equals(convertedType, symbol.ContainingType) Then 727If Equals(nodeType, symbol.ContainingType) Then
Completion\CompletionProviders\EnumCompletionProvider.vb (3)
111If Not Equals(_cachedDisplayAndInsertionTextContainingType, symbol.ContainingType) OrElse _cachedDisplayAndInsertionTextContext IsNot context Then 114_cachedDisplayAndInsertionTextContainingTypeText = symbol.ContainingType.ToMinimalDisplayString(context.SemanticModel, context.Position, displayFormat) 115_cachedDisplayAndInsertionTextContainingType = symbol.ContainingType
Completion\CompletionProviders\OverrideCompletionProvider.vb (1)
193If overriddenMember.ContainingType.SpecialType = SpecialType.System_Object Then
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (4)
536If symbol Is symbol.ContainingType?.DelegateInvokeMethod Then 537syntaxRefs = symbol.ContainingType.DeclaringSyntaxReferences 655Return method.ContainingType.TypeKind <> TypeKind.Struct 2042If newSymbol.ContainingType.TypeKind = TypeKind.Enum Then
EncapsulateField\VisualBasicEncapsulateFieldService.vb (4)
114Dim containingTypeMemberNames = field.ContainingType.GetAccessibleMembersInThisAndBaseTypes(Of ISymbol)(field.ContainingType).Select(Function(s) s.Name) 127Dim containingTypeMemberNames = field.ContainingType.GetAccessibleMembersInThisAndBaseTypes(Of ISymbol)(field.ContainingType).Select(Function(s) s.Name)
NavigationBar\VisualBasicNavigationBarItemService.vb (2)
250If type.ContainingType IsNot Nothing Then 251name &= " (" & type.ContainingType.ToDisplayString() & ")"
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (1)
178explicitInterfaceImplMethod, name:=desiredName, containingType:=explicitInterfaceImplMethod.ContainingType)
SignatureHelp\AbstractOrdinaryMethodSignatureHelpProvider.vb (1)
37result.AddRange(symbol.ContainingType.ToMinimalDisplayParts(semanticModel, position))
SignatureHelp\AttributeSignatureHelpProvider.vb (2)
113Dim namedParameters = constructor.ContainingType.GetAttributeNamedParameters(semanticModel.Compilation, within). 183result.AddRange(method.ContainingType.ToMinimalDisplayParts(semanticModel, position))
SignatureHelp\InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb (2)
42If invokeMethod.ContainingType.IsAnonymousType Then 45displayParts.AddRange(invokeMethod.ContainingType.ToMinimalDisplayParts(semanticModel, position))
SignatureHelp\InvocationExpressionSignatureHelpProvider.ElementAccess.vb (1)
55result.AddRange(symbol.ContainingType.ToMinimalDisplayParts(semanticModel, position))
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb (1)
40result.AddRange(invokeMethod.ContainingType.ToMinimalDisplayParts(semanticModel, position))
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.NormalType.vb (1)
62result.AddRange(method.ContainingType.ToMinimalDisplayParts(semanticModel, position))
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (2)
79Dim containingType = semanticModel.GetEnclosingSymbol(position, cancellationToken).ContainingType 136result.AddRange(eventSymbol.ContainingType.ToMinimalDisplayParts(semanticModel, position))
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
1322Assert.Equal("Event N1.Test.Percent(Percent As System.Single)", paramSymbol1.ContainingType.AssociatedSymbol.ToTestDisplayString())
Microsoft.CodeAnalysis.VisualBasic.Workspaces (38)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (1)
160symbol = symbol.ContainingType
Classification\SyntaxClassification\NameSyntaxClassifier.vb (1)
198Return If(fieldSymbol.ContainingType.IsEnumType(), ClassificationTypeNames.EnumMemberName, ClassificationTypeNames.ConstantName)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
2592Dim interfaceName = method.ContainingType.GenerateTypeSyntax()
Rename\VisualBasicRenameRewriterLanguageService.vb (7)
334symbol.ContainingType.IsImplicitlyDeclared AndAlso 335symbol.ContainingType.IsDelegateType AndAlso 336symbol.ContainingType.AssociatedSymbol IsNot Nothing Then 792If renamedSymbol.ContainingType IsNot Nothing AndAlso renamedSymbol.ContainingType.GetMembers(renamedSymbol.Name).Contains(renamedSymbol) Then 793Dim conflictingLocations = renamedSymbol.ContainingType.TypeParameters _ 936Dim baseType = renamedSymbol.ContainingType?.GetBaseTypes().FirstOrDefault()
Simplification\Reducers\VisualBasicEscapingReducer.vb (2)
104If symbol.ContainingType IsNot Nothing Then 105Dim type = symbol.ContainingType
Simplification\Simplifiers\AbstractVisualBasicSimplifier.vb (1)
73symbol = symbol.ContainingType
Simplification\Simplifiers\ExpressionSimplifier.vb (1)
241Dim containingType As INamedTypeSymbol = rightSymbol.ContainingType
Simplification\Simplifiers\NameSimplifier.vb (2)
43symbol = symbol.ContainingType 331symbolForName = symbolForName.ContainingType
Simplification\VisualBasicSimplificationService.Expander.vb (7)
253Dim containingType = reducedExtensionMethod.ContainingType.ToDisplayString(symbolDisplayFormat) 425If Not symbolForQualifiedName.ContainingType.Equals(symbolForLeftPart) Then 428Dim moduleIdentifierToken = SyntaxFactory.Identifier(symbolForQualifiedName.ContainingType.Name) 455If Not symbolForMemberAccess.ContainingType.Equals(symbolForLeftPart) Then 458Dim moduleIdentifierToken = SyntaxFactory.Identifier(symbolForMemberAccess.ContainingType.Name) 718If replaceNode OrElse symbol.ContainingType IsNot Nothing OrElse symbol.ContainingNamespace IsNot Nothing Then 804type = type.ContainingType
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\FieldGenerator.vb (1)
96Dim canUseFieldReference = field.Type IsNot Nothing AndAlso Not field.Type.Equals(field.ContainingType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationHelpers.vb (2)
68If explicitInterfaceOpt IsNot Nothing AndAlso explicitInterfaceOpt.ContainingType IsNot Nothing Then 69Dim type = explicitInterfaceOpt.ContainingType.GenerateTypeSyntax()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxGeneratorVisitor.vb (3)
39If symbol.ContainingType IsNot Nothing Then 40If symbol.ContainingType.TypeKind = TypeKind.Submission Then 43Dim container = symbol.ContainingType.Accept(Me)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\SymbolExtensions.vb (2)
35Dim containingType = symbol.ContainingType 37containingType.ContainingType IsNot Nothing OrElse
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (3)
159If symbol.ContainingType IsNot Nothing Then 160If symbol.ContainingType.TypeKind = TypeKind.Submission Then 163Return AddInformationTo(SyntaxFactory.QualifiedName(DirectCast(symbol.ContainingType.Accept(Me), NameSyntax), simpleNameSyntax), symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\SymbolExtensions.vb (4)
17If propertySymbol.ContainingType IsNot Nothing AndAlso 18propertySymbol.ContainingType.Name = "MyForms" AndAlso 19propertySymbol.ContainingType.ContainingNamespace IsNot Nothing AndAlso 20propertySymbol.ContainingType.ContainingNamespace.IsMyNamespace(compilation) Then
Microsoft.CodeAnalysis.Workspaces (143)
Classification\SyntaxClassification\AbstractNameSyntaxClassifier.cs (1)
23symbol = symbol.ContainingType;
Editing\SyntaxGenerator.cs (4)
134var canUseFieldReference = !LiteralSpecialValues.HasSpecialValues(field.ContainingType.SpecialType); 560constructorMethod.ContainingType != null ? constructorMethod.ContainingType.Name : "New", 815if (symbol.ContainingType?.IsRecord is true)
FindSymbols\FindReferences\BaseTypeFinder.cs (1)
39foreach (var type in FindBaseTypes(symbol.ContainingType))
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (2)
65else if (symbol.ContainingType != null && symbol.ContainingType.IsScriptClass)
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
783var containingType = definition.ContainingType;
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (1)
197var attributeSymbol = semanticModel.GetSymbolInfo(attributeNode, cancellationToken).Symbol?.ContainingType;
FindSymbols\FindReferences\Finders\ConstructorInitializerSymbolReferenceFinder.cs (1)
51}, symbol.ContainingType.Name, processResult, processResultData, cancellationToken);
FindSymbols\FindReferences\Finders\ConstructorSymbolReferenceFinder.cs (6)
29var containingType = symbol.ContainingType; 43var containingType = symbol.ContainingType; 44var typeName = symbol.ContainingType.Name; 101var containingType = methodSymbol.ContainingType; 178var predefinedType = symbol.ContainingType.SpecialType.ToPredefinedType(); 275foreach (var token in state.Cache.FindMatchingIdentifierTokens(symbol.ContainingType.Name, cancellationToken))
FindSymbols\FindReferences\Finders\EventSymbolReferenceFinder.cs (2)
26var backingFields = symbol.ContainingType.GetMembers() 31var associatedNamedTypes = symbol.ContainingType.GetTypeMembers()
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (2)
70ContainingType: INamedTypeSymbol { Name: "Program", ContainingNamespace.IsGlobalNamespace: true } 73names.Add(symbol.ContainingType.Name);
FindSymbols\FindReferences\Finders\OrdinaryMethodReferenceFinder.cs (2)
30return symbol.ContainingType.TypeKind == TypeKind.Delegate 31? new(ImmutableArray.Create<ISymbol>(symbol.ContainingType))
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (2)
210var containingType = containingMethod.ContainingType; 221else if (containingMethod.ContainingType.IsDelegateType() &&
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (2)
54foreach (var member in symbol.ContainingType.GetMembers()) 76ContainingType:
FindSymbols\FindReferences\Finders\TypeParameterSymbolReferenceFinder.cs (1)
35return FindDocumentsAsync(project, documents, processResult, processResultData, cancellationToken, symbol.Name, symbol.ContainingType.Name);
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (2)
127if (searchSymbol.IsConstructor() && searchSymbol.ContainingType.TypeKind == TypeKind.Delegate) 128searchSymbol = symbol.ContainingType;
FindSymbols\SymbolFinder_Helpers.cs (2)
137Contract.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Key.ContainingType == null)); 138Contract.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Value.ContainingType == null));
FindSymbols\SymbolFinder_Hierarchy.cs (4)
48var containingType = symbol.ContainingType; 129if (symbol is { DeclaredAccessibility: Accessibility.Public, ContainingType.TypeKind: TypeKind.Class or TypeKind.Struct }) 143var containingType = symbol.ContainingType.OriginalDefinition; 361var containingType = symbol.ContainingType.OriginalDefinition;
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
151if (IsSymbolObsolete(symbol) || IsSymbolObsolete(symbol?.ContainingType))
ReassignedVariable\AbstractReassignedVariableService.cs (1)
197var containingType = methodOrProperty.ContainingType;
Recommendations\AbstractRecommendationService.cs (1)
128var containingTypeOriginalDefinition = symbol.ContainingType.OriginalDefinition;
Rename\ConflictEngine\ConflictResolver.cs (1)
242var otherThingsNamedTheSame = renamedSymbol.ContainingType.GetMembers(renamedSymbol.Name)
Rename\ConflictEngine\DeclarationConflictHelpers.cs (2)
18renamedMethod.ContainingType.GetMembers(renamedMethod.Name) 29renamedProperty.ContainingType.GetMembers(renamedProperty.Name)
Rename\RenameUtilities.cs (3)
196var containingType = symbol.ContainingType; 226symbol.ContainingType.TypeKind == TypeKind.Interface) 365return methodSymbol.ContainingType;
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
127&& Equals(possibleConstructor.ContainingType.ConstructedFrom, namedType.ConstructedFrom);
Shared\Extensions\ISymbolExtensions.cs (2)
271if (symbol.ContainingType is null) 477var baseType = memberSymbol.ContainingType.BaseType;
Shared\Extensions\ITypeSymbolExtensions.cs (2)
75var interfaceType = interfaceMember.ContainingType; 84var originalInterfaceType = interfaceMember.ContainingType.OriginalDefinition;
Shared\Extensions\SemanticModelExtensions.cs (3)
24if (symbol.IsConstructor() && symbol.ContainingType.IsAnonymousType) 26return symbol.ContainingType; 54methodSymbol.ContainingType is ITypeSymbol containingType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (7)
45for (var current = symbol; current != null; current = current.ContainingType) 56for (var current = symbol; current != null; current = current.ContainingType) 87if (member.ContainingType.TypeKind == TypeKind.Interface) 158if (implementation?.ContainingType.TypeKind == TypeKind.Interface) 257return implementation != null && Equals(implementation.ContainingType, classOrStructType); 276return implementation != null && Equals(implementation.ContainingType, classOrStructType); 660ContainingType.SpecialType: SpecialType.System_Object,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
32ContainingType: { IsRecord: true } containingType, 64ContainingType: { } containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IPropertySymbolExtensions.cs (1)
12=> property.ContainingType.GetMembers()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (14)
95foreach (var baseType in symbol.ContainingType.GetBaseTypes()) 153foreach (var iface in symbol.ContainingType.AllInterfaces) 157var impl = symbol.ContainingType.FindImplementationForInterfaceMember(interfaceMember); 177return symbol is { ContainingType.TypeKind: TypeKind.Class, IsSealed: false } && 184symbol.ContainingType != null && 185symbol.ContainingType.TypeKind == TypeKind.Interface) 221return symbol.ContainingType; 270=> symbol?.Kind == SymbolKind.Field && symbol.ContainingType.IsEnumType(); 282=> symbol is { ContainingType.TypeKind: TypeKind.Module }; 318=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType(); 321=> symbol is IFieldSymbol { ContainingType.IsTupleType: true }; 444symbol = symbol.ContainingType; 463var containingType = symbol.ContainingType; 467containingType = containingType.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (5)
165return IsMemberAccessible(symbol.ContainingType, symbol.DeclaredAccessibility, within, throughType, out failedThroughTypeCheck); 201var containingType = type.ContainingType; 204: IsMemberAccessible(type.ContainingType, type.DeclaredAccessibility, within, null, out _); 398current = current.ContainingType; 444current = current.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (5)
140current = current.ContainingType; 146var current = type.ContainingType; 150current = current.ContainingType; 234b.ContainingType == null && 250&& symbol.ContainingType == null
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (2)
57if (symbol.ContainingType != null) 59accessibility = AccessibilityUtilities.Minimum(accessibility, symbol.ContainingType.Accept(this));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (2)
78var updatedContainingType = symbol.ContainingType?.Accept(this); 81if (!Equals(updatedContainingType, symbol.ContainingType))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (2)
67var containingType = symbol.ContainingType; 89var containingType = symbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (3)
30/// the "same" <see cref="ISymbol.ContainingType"/> and 33/// the "same" <see cref="ISymbol.ContainingType"/>, 59/// the "same" the "same" <see cref="ISymbol.ContainingType"/>,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (1)
116return reader.ReadSymbolKey(contextualType?.ContainingType, out failureReason);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.EventSymbolKey.cs (2)
16visitor.WriteSymbolKey(symbol.ContainingType); 23var containingTypeResolution = reader.ReadSymbolKey(contextualSymbol?.ContainingType, out var containingTypeFailureReason);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FieldSymbolKey.cs (2)
16visitor.WriteSymbolKey(symbol.ContainingType); 23var containingTypeResolution = reader.ReadSymbolKey(contextualSymbol?.ContainingType, out var containingTypeFailureReason);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (10)
416var type = methodSymbol.ContainingType; 417var newType = newMethodSymbol.ContainingType; 758&& symbol.ContainingType.SpecialType == SpecialType.System_Object 884symbol.ContainingType != null && 885symbol.ContainingType.IsAnonymousType(); 940if (newSymbol.ContainingType.IsDelegateType() && 941symbol.ContainingType.IsDelegateType() && 942IsReferenceConversion(this.OriginalSemanticModel.Compilation, newSymbol.ContainingType, symbol.ContainingType)) 994var newSymbolContainingType = newSymbol.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (4)
189if (property1.ContainingType == null || 190property1.ContainingType.TypeKind == TypeKind.Interface) 199if (property2.ContainingType == null || 200property2.ContainingType.TypeKind == TypeKind.Interface)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (1)
200if (x is { MethodKind: MethodKind.DelegateInvoke, ContainingType.IsAnonymousType: true })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (6)
397x.ContainingType == null && 586if (x.ContainingType.IsAnonymousType && y.ContainingType.IsAnonymousType) 619(x.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(x.ContainingType)) || 623(y.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(y.ContainingType)) || 640if (x.TypeParameterKind == TypeParameterKind.Type && x.ContainingType.IsAnonymousType)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
263(x.TypeParameterKind == TypeParameterKind.Type && IsConstructedFromSelf(x.ContainingType)) || 275if (x.TypeParameterKind == TypeParameterKind.Type && x.ContainingType.IsAnonymousType)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
377return field != null && field.ContainingType.IsEnumType();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (1)
48var type = ctor.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\INamedTypeSymbolExtensions.cs (1)
20namedType.ContainingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationConstructorInfo.cs (1)
84=> info == null ? constructor.ContainingType.Name : info._typeName;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationDestructorInfo.cs (1)
52=> info == null ? constructor.ContainingType.Name : info._typeName;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IMethodSymbolExtensions.cs (4)
63method.ContainingType, 89method.ContainingType, 116typeParameter.ContainingType, 164containingType: method.ContainingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (2)
26property.ContainingType, 52property.ContainingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (3)
131member.ContainingType is { TypeKind: TypeKind.Interface } interfaceBeingImplemented) 167explicitlyImplementedProperty.ContainingType, 183var classOrStructType = throughMember.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
448var containingType = property.ContainingType;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (3)
66var containingType = parameter.ContainingType; 84var containingType = parameter.ContainingType; 150memberReference.Member.ContainingType.Equals(containingType))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
123symbol.ContainingType?.SpecialType == SpecialType.System_Enum;
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
FindReferencesTests.cs (2)
496var refsFromVirtualSorted = refsFromVirtual.Select(r => r.Definition).OrderBy(r => r.ContainingType.Name).ToArray(); 497var refsFromOverrideSorted = refsFromOverride.Select(r => r.Definition).OrderBy(r => r.ContainingType.Name).ToArray();
Microsoft.DotNet.CodeAnalysis (3)
Analyzers\AppContextDefaultsAnalyzer.cs (2)
133if (!StringComparer.Ordinal.Equals(methodSym.ContainingType.Name, "LocalAppContext") && 134!StringComparer.Ordinal.Equals(methodSym.ContainingType.Name, "AppContext"))
Analyzers\ResourceUsageAnalyzer.cs (1)
47SymbolEqualityComparer.Default.Equals(memberSymbol.ContainingType, SRSymbol) &&
Microsoft.Extensions.Logging.Generators (2)
LoggerMessageGenerator.Parser.cs (1)
113if (attrCtorSymbol == null || !loggerMessageAttribute.Equals(attrCtorSymbol.ContainingType, SymbolEqualityComparer.Default))
LoggerMessageGenerator.Roslyn3.11.cs (1)
81INamedTypeSymbol attributeContainingTypeSymbol = attributeSymbol.ContainingType;
Microsoft.Gen.ComplianceReports (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
110var attributeType = ctor?.ContainingType;
Microsoft.Gen.ContextualOptions (1)
src\Generators\Shared\GeneratorUtilities.cs (1)
110var attributeType = ctor?.ContainingType;
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (7)
326lt.AllMembers.AddRange(methodSymbol.ContainingType.GetMembers().Select(x => x.Name)); 330var parentType = methodSymbol.ContainingType.ContainingType; 349parentType = parentType.ContainingType; 425Diag(DiagDescriptors.ShouldntReuseEventIds, attrLoc, lm.EventId.Value, methodSymbol.ContainingType.Name); 434Diag(DiagDescriptors.ShouldntReuseEventNames, attrLoc, lm.EventName, methodSymbol.ContainingType.Name); 610if (attrCtor != null && SymbolEqualityComparer.Default.Equals(attrCtor.ContainingType, symbols.LoggerMessageAttribute))
src\Generators\Shared\GeneratorUtilities.cs (1)
110var attributeType = ctor?.ContainingType;
Microsoft.Gen.Metrics (4)
Parser.cs (3)
147var parentType = methodSymbol.ContainingType.ContainingType; 170parentType = parentType.ContainingType;
src\Generators\Shared\GeneratorUtilities.cs (1)
110var attributeType = ctor?.ContainingType;
Microsoft.Gen.MetricsReports (4)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (3)
147var parentType = methodSymbol.ContainingType.ContainingType; 170parentType = parentType.ContainingType;
src\Generators\Shared\GeneratorUtilities.cs (1)
110var attributeType = ctor?.ContainingType;
Microsoft.Interop.ComInterfaceGenerator (6)
ComInterfaceGenerator.cs (2)
271GeneratedComInterfaceCompilationData.TryGetGeneratedComInterfaceAttributeFromInterface(symbol.ContainingType, out var generatedComAttribute); 376var declaringType = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(symbol.ContainingType);
VtableIndexStubGenerator.cs (4)
290var interfaceType = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(symbol.ContainingType); 294bool implementsIUnmanagedInterfaceOfSelf = symbol.ContainingType.AllInterfaces.Any(iface => SymbolEqualityComparer.Default.Equals(iface, expectedUnmanagedInterfaceType)); 300var unmanagedObjectUnwrapper = symbol.ContainingType.GetAttributes().FirstOrDefault(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)); 419if (!method.ContainingType.GetAttributes().Any(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)))
Microsoft.Interop.JavaScript.JSImportGenerator (5)
JSSignatureContext.cs (5)
47string stubTypeFullName = method.ContainingType.ToDisplayString(TypeContainingTypesAndNamespacesStyle); 64var fullName = $"{method.ContainingType.ToDisplayString()}.{method.Name}"; 82string typeName = method.ContainingType.ToDisplayString(TypeAndContainingTypesStyle).Replace(".", "/"); 84if (!method.ContainingType.ContainingNamespace.IsGlobalNamespace) 85typeName = $"{method.ContainingType.ContainingNamespace.ToDisplayString()}.{typeName}";
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\ConvertToLibraryImportAnalyzer.cs (1)
186AttributeData? bestFitMappingContainingType = method.ContainingType.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute);
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (3)
43if (FindContainingEntryPointTypeAndManagedType(diagnosedSymbol.ContainingType) is (INamedTypeSymbol entryPointMarshallerType, INamedTypeSymbol managedType)) 46(MarshallerShape _, StatefulMarshallerShapeHelper.MarshallerMethods methods) = StatefulMarshallerShapeHelper.GetShapeForType(diagnosedSymbol.ContainingType, managedType, isLinearCollectionMarshaller, context.Compilation); 58for (INamedTypeSymbol containingType = marshallerType; containingType is not null; containingType = containingType.ContainingType)
Microsoft.Interop.SourceGeneration (6)
MarshallerShape.cs (1)
248currentType = currentType.ContainingType;
SignatureContext.cs (2)
161for (INamedTypeSymbol type = method.ContainingType; type is not null; type = type.ContainingType)
TypeSymbolExtensions.cs (3)
230for (INamedTypeSymbol originalTypeDefinition = unboundConstructedType.OriginalDefinition; originalTypeDefinition is not null; originalTypeDefinition = originalTypeDefinition.ContainingType) 310for (INamedTypeSymbol instantiatedType = genericType; instantiatedType is not null; instantiatedType = instantiatedType.ContainingType) 342current = (INamespaceOrTypeSymbol)current.ContainingType ?? current.ContainingNamespace;
Microsoft.Maui.Controls.BindingSourceGen (7)
InvocationParser.cs (5)
36 if ((symbol?.ContainingType?.Name != "Binding" && symbol?.ContainingType?.Name != "BindingBase") 37 || symbol?.ContainingType?.ContainingNamespace.ToDisplayString() is not "Microsoft.Maui.Controls") 75 || methodSymbol.ContainingType?.Name != "BindableObjectExtensions" 76 || methodSymbol.ContainingType?.ContainingNamespace.ToDisplayString() is not "Microsoft.Maui.Controls")
ISymbolExtensions.cs (1)
31 var containgType = propertySymbol.ContainingType;
PathParser.cs (1)
55 var containgType = symbol.ContainingType.CreateTypeDescription(_enabledNullable);
Microsoft.VisualStudio.LanguageServices (19)
CallHierarchy\CallHierarchyItem.cs (1)
44ContainingTypeName = symbol.ContainingType.ToDisplayString(ContainingTypeFormat);
Implementation\VsRefactorNotifyService.cs (1)
168symbol = symbol.ContainingType;
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (1)
228await BuildMemberOfAsync(symbol.ContainingType, cancellationToken).ConfigureAwait(true);
Library\ObjectBrowser\AbstractListItemFactory.cs (1)
88var containingType = memberSymbol.ContainingType;
Library\ObjectBrowser\Lists\MemberListItem.cs (1)
27if (fieldSymbol.ContainingType.TypeKind == TypeKind.Enum)
Library\VsNavInfo\NavInfoFactory.cs (1)
124className: GetClassName(memberSymbol.ContainingType),
Progression\GraphBuilder.cs (4)
629node[RoslynGraphProperties.TypeKind] = method.ContainingType.TypeKind; 642if (field.ContainingType.TypeKind == TypeKind.Enum) 662node[RoslynGraphProperties.TypeKind] = property.ContainingType.TypeKind; 675node[RoslynGraphProperties.TypeKind] = eventSymbol.ContainingType.TypeKind;
Progression\GraphNodeIdCreation.cs (7)
94items.Add(await GetPartialForTypeAsync(symbol.ContainingType, CodeGraphNodeIdName.Type, solution, cancellationToken).ConfigureAwait(false)); 156if (namedType.ContainingType == null && Equals(namedType.ConstructedFrom, namedType) && namedType.Arity == 0) 203if (namedType.ContainingType != null) 205partials.Add(await GetPartialForTypeAsync(namedType.ContainingType, CodeGraphNodeIdName.ParentType, solution, cancellationToken, hasGenericArguments).ConfigureAwait(false)); 228if (pointerType.PointedAtType.ContainingType != null) 230partials.Add(await GetPartialForTypeAsync(pointerType.PointedAtType.ContainingType, CodeGraphNodeIdName.ParentType, solution, cancellationToken).ConfigureAwait(false)); 292partials.AddRange(await GetPartialsForNamespaceAndTypeAsync(member.ContainingType, true, solution, cancellationToken).ConfigureAwait(false));
ProjectSystem\AbstractEntryPointFinder.cs (1)
39EntryPoints.Add(symbol.ContainingType);
PullMemberUp\VisualStudioPullMemberUpService.cs (1)
43var containingType = selectedMembers[0].ContainingType;
Microsoft.VisualStudio.LanguageServices.CSharp (6)
LanguageService\CSharpHelpContextService.cs (1)
573var containingType = FormatNamespaceOrTypeSymbol(symbol.ContainingType);
ObjectBrowser\DescriptionBuilder.cs (4)
238if (memberSymbol.ContainingType != null && memberSymbol.ContainingType.TypeKind == TypeKind.Interface) 253fieldSymbol.ContainingType.TypeKind == TypeKind.Enum) 470if (fieldSymbol.ContainingType.TypeKind != TypeKind.Enum)
Progression\CSharpProgressionLanguageService.cs (1)
118case IFieldSymbol f: return f.ContainingType.TypeKind == TypeKind.Enum ? null : f.Type;
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
GlyphExtensionsTests.cs (1)
210symbolMock.SetupGet(s => s.ContainingType).Returns(containingType);
Microsoft.VisualStudio.LanguageServices.UnitTests (3)
CommonControls\MemberSelectionViewModelTests.vb (1)
185Dim membersInType = memberSymbol.ContainingType.GetMembers().WhereAsArray(Function(member) MemberAndDestinationValidator.IsMemberValid(member))
PullMemberUp\PullMemberUpViewModelTest.vb (2)
257Dim baseTypeTree = BaseTypeTreeNodeViewModel.CreateBaseTypeTree(glyphService:=Nothing, workspaceDoc.Project.Solution, memberSymbol.ContainingType, CancellationToken.None) 258Dim membersInType = memberSymbol.ContainingType.GetMembers().WhereAsArray(Function(member) MemberAndDestinationValidator.IsMemberValid(member))
Microsoft.VisualStudio.LanguageServices.VisualBasic (10)
CodeModel\MethodXML\MethodXmlBuilder.vb (6)
147GenerateType(eventSymbol.ContainingType, implicit:=True, assemblyQualify:=True) 372symbolOpt?.ContainingType?.TypeKind = TypeKind.Module Then 374leftHandSymbol = symbolOpt.ContainingType 432If Me.Symbol.ContainingType.InheritsFromOrEquals(symbol.ContainingType) Then 439GenerateType(symbol.ContainingType) 686GenerateType(delegateSymbol.ContainingType, implicit:=True, assemblyQualify:=True)
Help\VisualBasicHelpContextService.vb (1)
116Dim containingType = FormatSymbol(symbol.ContainingType, isContainingType:=True)
ObjectBrowser\DescriptionBuilder.vb (2)
353If memberSymbol.ContainingType IsNot Nothing And memberSymbol.ContainingType.TypeKind = TypeKind.Interface Then
Progression\VisualBasicProgressionLanguageService.vb (1)
82If symbol.Kind = SymbolKind.Field AndAlso symbol.ContainingType.TypeKind = TypeKind.Enum Then
System.Private.CoreLib.Generators (13)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (13)
416if (symbol.ContainingType != null && !examinedSymbols.Contains(symbol.ContainingType)) 417symbolsToExamine.Push(symbol.ContainingType); 438if (symbol.ContainingType != null && !examinedSymbols.Contains(symbol.ContainingType)) 439symbolsToExamine.Push(symbol.ContainingType); 470(methodSymbol.ContainingType.Equals(symbol.ContainingSymbol, SymbolEqualityComparer.Default) 471|| (methodSymbol.ContainingType.ContainingType != null && methodSymbol.ContainingType.ContainingType.Equals(symbol.ContainingType, SymbolEqualityComparer.Default)))) 685if (onLoadData.NamedTypesToBeProtected.Contains(symbol.ContainingType))
System.Text.Json.SourceGeneration (4)
Helpers\RoslynExtensions.cs (3)
82INamedTypeSymbol? containingType = namedType.ContainingType; 223return member.Name == otherMember.Name && member.ContainingType.IsAssignableFrom(otherMember.ContainingType);
src\libraries\Common\src\SourceGenerators\TypeModelHelper.cs (1)
26if (current.ContainingType is INamedTypeSymbol parent)
System.Text.RegularExpressions.Generator (3)
RegexGenerator.Parser.cs (1)
202string? ns = regexMemberSymbol.ContainingType?.ContainingNamespace?.ToDisplayString(
UpgradeToGeneratedRegexAnalyzer.cs (1)
95if (!method.IsStatic || !SymbolEqualityComparer.Default.Equals(method.ContainingType, regexTypeSymbol))
UpgradeToGeneratedRegexCodeFixer.cs (1)
111semanticModel.GetDeclaredSymbol((CompilationUnitSyntax)typeDeclarationOrCompilationUnit, cancellationToken)?.ContainingType;
System.Windows.Forms.Analyzers.CSharp (3)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (3)
31if (propertySymbol.ContainingType is null 33.ContainingType 58INamedTypeSymbol classSymbol = propertySymbol.ContainingType;
System.Windows.Forms.Analyzers.VisualBasic (3)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (3)
36If propertySymbol.ContainingType Is Nothing OrElse 37Not propertySymbol.ContainingType.AllInterfaces.Any( 61Dim classSymbol As INamedTypeSymbol = propertySymbol.ContainingType