2 implementations of IPropertySymbol
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\PropertySymbol.cs (1)
13internal sealed class PropertySymbol : Symbol, IPropertySymbol
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
16Implements IPropertySymbol, IPropertySymbolInternal
1441 references to IPropertySymbol
ConfigurationSchemaGenerator (8)
ConfigSchemaEmitter.cs (5)
279private bool GenerateProperty(JsonObject currentNode, PropertySpec property, IPropertySymbol? propertySymbol) 382private IPropertySymbol? GetPropertySymbol(TypeSpec type, PropertySpec property) 384IPropertySymbol? propertySymbol = null; 388propertySymbol = typeSymbol.GetMembers(property.Name).FirstOrDefault() as IPropertySymbol; 395private static bool ShouldSkipProperty(PropertySpec property, TypeSpec propertyType, IPropertySymbol? propertySymbol)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (1)
669if (member is IPropertySymbol { IsIndexer: false, IsImplicitlyDeclared: false } property && !IsUnsupportedType(property.Type))
RuntimeSource\Configuration.Binder\Specs\Members\MemberSpec.cs (1)
14Debug.Assert(member is IPropertySymbol or IParameterSymbol);
RuntimeSource\Configuration.Binder\Specs\Members\PropertySpec.cs (1)
11public PropertySpec(IPropertySymbol property, TypeRef typeRef) : base(property, typeRef)
ILLink.RoslynAnalyzer (49)
DataFlow\DynamicallyAccessedMembersBinder.cs (6)
88 foreach (var p in typeDefinition.GetPropertiesOnTypeHierarchy (filter: null, bindingFlags: BindingFlags.NonPublic | declaredOnlyFlags)) 93 foreach (var p in typeDefinition.GetPropertiesOnTypeHierarchy (filter: null, bindingFlags: BindingFlags.Public | declaredOnlyFlags)) 240 public static IEnumerable<IPropertySymbol> GetPropertiesOnTypeHierarchy (this ITypeSymbol thisType, Func<IPropertySymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default) 245 foreach (var property in type.GetMembers ().OfType<IPropertySymbol> ()) {
DataFlow\LocalDataFlowVisitor.cs (5)
103 Debug.Assert (OwningSymbol is IMethodSymbol or IFieldSymbol or IPropertySymbol, 273 if (OwningSymbol is IPropertySymbol && (ControlFlowGraph.OriginalOperation is not IAttributeOperation)) 300 var property = (IPropertySymbol) indexerRef.IndexerSymbol; 645 if (operation.IndexerSymbol is not IPropertySymbol indexerProperty) {
DataFlow\MethodBodyValue.cs (1)
23 Debug.Assert (owningSymbol is (IMethodSymbol or IFieldSymbol or IPropertySymbol));
DynamicallyAccessedMembersAnalyzer.cs (2)
164 } else if (member is IPropertySymbol property && property.GetDynamicallyAccessedMemberTypes () != DynamicallyAccessedMemberTypes.None && !property.Type.IsTypeInterestingForDataflow (isByRef: property.ReturnsByRef)) { 282 || methodSymbol.AssociatedSymbol is not IPropertySymbol propertySymbol
IPropertySymbolExtensions.cs (4)
10 public static IMethodSymbol? GetGetMethod (this IPropertySymbol property) 12 IPropertySymbol? declaringProperty = property; 21 public static IMethodSymbol? GetSetMethod (this IPropertySymbol property) 23 IPropertySymbol? declaringProperty = property;
ISymbolExtensions.cs (2)
80 internal static ValueSet<string> GetFeatureGuardAnnotations (this IPropertySymbol propertySymbol) 110 IPropertySymbol property => property.OverriddenProperty,
RequiresAnalyzerBase.cs (4)
131 IPropertySymbol property => property.ContainingType, 311 private protected virtual bool IsRequiresCheck (IPropertySymbol propertySymbol, Compilation compilation) => false; 313 internal static bool IsAnnotatedFeatureGuard (IPropertySymbol propertySymbol, string featureName) 323 internal bool IsFeatureGuard (IPropertySymbol propertySymbol, Compilation compilation)
RequiresAssemblyFilesAnalyzer.cs (6)
64 private protected override bool IsRequiresCheck (IPropertySymbol propertySymbol, Compilation compilation) 72 var isDynamicCodeSupportedProperty = runtimeFeaturesType.GetMembers ("IsAssemblyFilesSupported").OfType<IPropertySymbol> ().FirstOrDefault (); 86 ImmutableArrayOperations.AddIfNotNull (dangerousPatternsBuilder, ImmutableArrayOperations.TryGetSingleSymbol<IPropertySymbol> (assemblyType.GetMembers ("Location"))); 95 ImmutableArrayOperations.AddIfNotNull (dangerousPatternsBuilder, ImmutableArrayOperations.TryGetSingleSymbol<IPropertySymbol> (assemblyNameType.GetMembers ("CodeBase"))); 96 ImmutableArrayOperations.AddIfNotNull (dangerousPatternsBuilder, ImmutableArrayOperations.TryGetSingleSymbol<IPropertySymbol> (assemblyNameType.GetMembers ("EscapedCodeBase")));
RequiresDynamicCodeAnalyzer.cs (3)
127 private protected override bool IsRequiresCheck (IPropertySymbol propertySymbol, Compilation compilation) { 132 var isDynamicCodeSupportedProperty = runtimeFeaturesType.GetMembers ("IsDynamicCodeSupported").OfType<IPropertySymbol> ().FirstOrDefault ();
RequiresUnreferencedCodeAnalyzer.cs (3)
67 private protected override bool IsRequiresCheck (IPropertySymbol propertySymbol, Compilation compilation) 75 var isDynamicCodeSupportedProperty = runtimeFeaturesType.GetMembers ("IsUnreferencedCodeSupported").OfType<IPropertySymbol> ().FirstOrDefault ();
TrimAnalysis\FeatureCheckReturnValuePattern.cs (2)
19 public IPropertySymbol OwningSymbol { get; init; } 25 IPropertySymbol owningSymbol)
TrimAnalysis\FlowAnnotations.cs (4)
162 var property = (IPropertySymbol) parameterMethod.AssociatedSymbol!; 181 var property = (IPropertySymbol) method.AssociatedSymbol!;
TrimAnalysis\HandleCallAction.cs (2)
237 var property = (IPropertySymbol) method.Method.AssociatedSymbol!;
TrimAnalysis\ReflectionAccessAnalyzer.cs (3)
38 case IPropertySymbol property: 70 foreach (var prop in typeSymbol.GetPropertiesOnTypeHierarchy (p => p.Name == name, bindingFlags)) 166 internal void GetReflectionAccessDiagnosticsForProperty (Location location, IPropertySymbol propertySymbol)
TrimAnalysis\TrimAnalysisVisitor.cs (2)
367 IPropertySymbol propertySymbol = (IPropertySymbol) method.AssociatedSymbol!;
Microsoft.Analyzers.Extra (4)
CallAnalysis\CallAnalyzer.Registrar.cs (3)
127public void RegisterProperty(IPropertySymbol prop, Action<OperationAnalysisContext, IPropertyReferenceOperation> action) 153foreach (var prop in type.GetMembers(m).OfType<IPropertySymbol>())
CallAnalysis\CallAnalyzer.State.cs (1)
18public readonly Dictionary<IPropertySymbol, List<Action<OperationAnalysisContext, IPropertyReferenceOperation>>> Props = new(SymbolEqualityComparer.Default);
Microsoft.Analyzers.Local (8)
ApiLifecycle\AssemblyAnalysis.cs (1)
232else if (member is IPropertySymbol)
CallAnalysis\CallAnalyzer.Registrar.cs (3)
127public void RegisterProperty(IPropertySymbol prop, Action<OperationAnalysisContext, IPropertyReferenceOperation> action) 153foreach (var prop in type.GetMembers(m).OfType<IPropertySymbol>())
CallAnalysis\CallAnalyzer.State.cs (1)
18public readonly Dictionary<IPropertySymbol, List<Action<OperationAnalysisContext, IPropertyReferenceOperation>>> Props = new(SymbolEqualityComparer.Default);
CallAnalysis\ToInvariantString.cs (2)
47var invariantCulture = cultureInfo?.GetMembers("InvariantCulture").OfType<IPropertySymbol>().SingleOrDefault();
Utilities\SymbolExtensions.cs (1)
170else if (symbol is IPropertySymbol propertySymbol)
Microsoft.AspNetCore.Analyzers (2)
OptionsItem.cs (2)
10public OptionsItem(IPropertySymbol property, object constantValue) 18public IPropertySymbol Property { get; }
Microsoft.AspNetCore.App.Analyzers (13)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
176var property = propertyReferenceOperation.Property;
Authorization\AuthorizationOptionsTypes.cs (4)
22var authorizationOptionsProperties = authorizationOptionsMembers.OfType<IPropertySymbol>(); 37public IPropertySymbol? DefaultPolicy { get; } 38public IPropertySymbol? FallbackPolicy { get; } 39public IPropertySymbol? InvokeHandlersAfterFailure { get; }
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
25var property = propertyReference.Property;
RouteEmbeddedLanguage\Infrastructure\RoutePatternParametersDetector.cs (1)
69ITypeSymbol typeSymbol => typeSymbol.GetMembers().OfType<IPropertySymbol>().ToImmutableArray().As<ISymbol>(),
RouteEmbeddedLanguage\Infrastructure\RouteStringSyntaxDetector.cs (1)
303return symbol is IFieldSymbol or IPropertySymbol &&
src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
73public static bool HasAttribute(this IPropertySymbol propertySymbol, ITypeSymbol attribute, bool inherit) 83IPropertySymbol? current = propertySymbol;
src\Shared\RoslynUtils\SymbolExtensions.cs (3)
148IPropertySymbol propertySymbol => propertySymbol.Type, 157IPropertySymbol parameterSymbol => parameterSymbol.Parameters, 170public static bool IsOptional(this IPropertySymbol propertySymbol) =>
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\AddPackageFixer.cs (1)
70IPropertySymbol propertySymbol => propertySymbol.Type,
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
67IPropertySymbol propertySymbol => propertySymbol.Type,
Microsoft.AspNetCore.Components.Analyzers (13)
ComponentFacts.cs (4)
13public static bool IsAnyParameter(ComponentSymbols symbols, IPropertySymbol property) 31public static bool IsParameter(ComponentSymbols symbols, IPropertySymbol property) 46public static bool IsParameterWithCaptureUnmatchedValues(ComponentSymbols symbols, IPropertySymbol property) 75public static bool IsCascadingParameter(ComponentSymbols symbols, IPropertySymbol property)
ComponentParameterAnalyzer.cs (6)
52var properties = new List<IPropertySymbol>(); 57if (member is IPropertySymbol property && ComponentFacts.IsParameter(symbols, property)) 71var captureUnmatchedValuesParameters = new List<IPropertySymbol>(); 74foreach (var property in properties) 144private static bool IsAutoProperty(IPropertySymbol propertySymbol) 149private static bool IsSameSemanticAsAutoProperty(IPropertySymbol symbol, CancellationToken cancellationToken)
ComponentParameterUsageAnalyzer.cs (2)
67var componentProperty = (IPropertySymbol)propertyReference.Member;
InternalUsageAnalyzer.cs (1)
116case IPropertySymbol property:
Microsoft.AspNetCore.Components.SdkAnalyzers (11)
ComponentFacts.cs (4)
13public static bool IsAnyParameter(ComponentSymbols symbols, IPropertySymbol property) 31public static bool IsParameter(ComponentSymbols symbols, IPropertySymbol property) 46public static bool IsParameterWithCaptureUnmatchedValues(ComponentSymbols symbols, IPropertySymbol property) 75public static bool IsCascadingParameter(ComponentSymbols symbols, IPropertySymbol property)
ComponentParameterAnalyzer.cs (4)
46var properties = new List<IPropertySymbol>(); 51if (member is IPropertySymbol property && ComponentFacts.IsParameter(symbols, property)) 65var captureUnmatchedValuesParameters = new List<IPropertySymbol>(); 68foreach (var property in properties)
ComponentParameterUsageAnalyzer.cs (2)
67var componentProperty = (IPropertySymbol)propertyReference.Member;
InternalUsageAnalyzer.cs (1)
116case IPropertySymbol property:
Microsoft.AspNetCore.Http.RequestDelegateGenerator (12)
src\Shared\RoslynUtils\SymbolExtensions.cs (3)
148IPropertySymbol propertySymbol => propertySymbol.Type, 157IPropertySymbol parameterSymbol => parameterSymbol.Parameters, 170public static bool IsOptional(this IPropertySymbol propertySymbol) =>
StaticRouteHandlerModel\EndpointParameter.cs (8)
30private EndpointParameter(Endpoint endpoint, IPropertySymbol property, IParameterSymbol? parameter, WellKnownTypes wellKnownTypes) : this(endpoint, property.Type, property.Name, wellKnownTypes) 169if (symbol is IPropertySymbol || 173if (symbol is IPropertySymbol) 438else if (typeSymbol is IPropertySymbol property) 473var properties = type.GetMembers().OfType<IPropertySymbol>().Where(property => property.DeclaredAccessibility == Accessibility.Public); 479var lookupTable = new Dictionary<ParameterLookupKey, IPropertySymbol>(); 480foreach (var property in properties) 498if (lookupTable.TryGetValue(key, out var property))
StaticRouteHandlerModel\Model\ConstructorParameter.cs (1)
7internal record ConstructorParameter(IPropertySymbol Property, IParameterSymbol? Parameter);
Microsoft.AspNetCore.Mvc.Analyzers (2)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
73public static bool HasAttribute(this IPropertySymbol propertySymbol, ITypeSymbol attribute, bool inherit) 83IPropertySymbol? current = propertySymbol;
Microsoft.AspNetCore.Mvc.Api.Analyzers (9)
ActualApiResponseMetadataFactory.cs (3)
170var property = propertyReference.Property; 259private static bool IsInterfaceImplementation(IPropertySymbol property, IPropertySymbol statusCodeActionResultStatusProperty)
ApiControllerSymbolCache.cs (4)
91var statusCodeActionResultStatusProperty = (IPropertySymbol?)statusCodeActionResult?.GetMembers("StatusCode")[0]; 143IPropertySymbol statusCodeActionResultStatusProperty, 189public IPropertySymbol StatusCodeActionResultStatusProperty { get; }
src\Shared\Roslyn\CodeAnalysisExtensions.cs (2)
73public static bool HasAttribute(this IPropertySymbol propertySymbol, ITypeSymbol attribute, bool inherit) 83IPropertySymbol? current = propertySymbol;
Microsoft.CodeAnalysis (47)
CodeGen\PermissionSetAttribute.cs (1)
86member => member.Kind == SymbolKind.Property && ((IPropertySymbol)member).Type.SpecialType == SpecialType.System_String));
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
209else if (member is IPropertySymbol { PartialImplementationPart: { } propertyImplementation })
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (2)
728var propertySymbol = symbol as IPropertySymbol;
DocumentationCommentId.cs (4)
363public override void VisitProperty(IPropertySymbol symbol) 440public override bool VisitProperty(IPropertySymbol symbol) 1306var propertySymbol = symbol as IPropertySymbol;
Emit\EditAndContinue\SymbolChanges.cs (2)
381Debug.Assert(edit.OldSymbol is IMethodSymbol or IPropertySymbol or IEventSymbol); 446Debug.Assert(edit.OldSymbol == null || ((IPropertySymbol)edit.OldSymbol).PartialImplementationPart == null);
Emit\SemanticEdit.cs (3)
145if (oldSymbol is IMethodSymbol { PartialImplementationPart: not null } or IPropertySymbol { PartialImplementationPart: not null }) 150if (newSymbol is IMethodSymbol { PartialImplementationPart: not null } or IPropertySymbol { PartialImplementationPart: not null }) 155if (kind == SemanticEditKind.Delete && oldSymbol is not (IMethodSymbol or IPropertySymbol or IEventSymbol))
Generated\Operations.Generated.cs (6)
998IPropertySymbol Property { get; } 2398ImmutableArray<IPropertySymbol> InitializedProperties { get; } 5456internal PropertyReferenceOperation(IPropertySymbol property, ITypeSymbol? constrainedToType, ImmutableArray<IArgumentOperation> arguments, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5464public IPropertySymbol Property { get; } 7608internal PropertyInitializerOperation(ImmutableArray<IPropertySymbol> initializedProperties, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7613public ImmutableArray<IPropertySymbol> InitializedProperties { get; }
Operations\ControlFlowGraphBuilder.Context.cs (3)
22public readonly ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>> AnonymousTypePropertyValues; 24internal Context(IOperation? implicitInstance, INamedTypeSymbol? anonymousType, ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>> anonymousTypePropertyValues) 38ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>>.Empty);
Operations\ControlFlowGraphBuilder.cs (9)
6420IOperation visitAndCaptureInitializer(IPropertySymbol initializedProperty, IOperation initializer) 7236foreach (IPropertySymbol propertySymbol in operation.InitializedProperties) 7958.Select(m => (IPropertySymbol)m); 7975var explicitProperties = new Dictionary<IPropertySymbol, IOperation>(SymbolEqualityComparer.IgnoreAll); 8002var property = propertyReference.Property; 8022foreach (IPropertySymbol property in properties) 8056SimpleAssignmentOperation makeAssignment(IPropertySymbol property, IOperation capturedValue, WithOperation operation) 8071static bool setsAllProperties(ImmutableArray<IOperation> initializers, IEnumerable<IPropertySymbol> properties) 8073var set = new HashSet<IPropertySymbol>(SymbolEqualityComparer.IgnoreAll);
Operations\ControlFlowGraphBuilder.ImplicitInstanceInfo.cs (4)
33public PooledDictionary<IPropertySymbol, IOperation>? AnonymousTypePropertyValues { get; } 49AnonymousTypePropertyValues = PooledDictionary<IPropertySymbol, IOperation>.GetInstance(); 66AnonymousTypePropertyValues = PooledDictionary<IPropertySymbol, IOperation>.GetInstance(); 68foreach (KeyValuePair<IPropertySymbol, IOperation> pair in context.AnonymousTypePropertyValues)
Operations\Loops\ForEachLoopOperationInfo.cs (2)
18public readonly IPropertySymbol CurrentProperty; 46IPropertySymbol currentProperty,
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (2)
111var propertySymbol = symbol as IPropertySymbol;
Symbols\IPropertySymbol.cs (5)
89new IPropertySymbol OriginalDefinition { get; } 94IPropertySymbol? OverriddenProperty { get; } 102ImmutableArray<IPropertySymbol> ExplicitInterfaceImplementations { get; } 118IPropertySymbol? PartialDefinitionPart { get; } 124IPropertySymbol? PartialImplementationPart { get; }
Symbols\SymbolVisitor.cs (1)
98public virtual void VisitProperty(IPropertySymbol symbol)
Symbols\SymbolVisitor`1.cs (1)
101public virtual TResult? VisitProperty(IPropertySymbol symbol)
Symbols\SymbolVisitor`2.cs (1)
106public virtual TResult VisitProperty(IPropertySymbol symbol, TArgument argument)
Microsoft.CodeAnalysis.CodeStyle (90)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (8)
105private readonly HashSet<IPropertySymbol> _propertiesWithShadowGetAccessorUsages = []; 358if (memberSymbol is IPropertySymbol propertySymbol) 508member is IPropertySymbol property && 517member is IPropertySymbol { GetMethod: not null, SetMethod: not null } property2 && 563case IPropertySymbol when isConvertibleProperty: 680case IPropertySymbol or IFieldSymbol: 835return ((IPropertySymbol)memberSymbol).ExplicitInterfaceImplementations.IsEmpty; 866methodSymbol.ContainingType.GetMembers(suffix).Any(static m => m is IPropertySymbol);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (3)
345if (semanticModel.GetDeclaredSymbol(propertyDeclaration, cancellationToken) is not IPropertySymbol property) 496protected virtual bool CanConvert(IPropertySymbol property) 545using var _2 = PooledHashSet<IPropertySymbol>.GetInstance(out var reportedProperties);
src\Analyzers\Core\Analyzers\UseAutoProperty\AnalysisResult.cs (1)
32IPropertySymbol Property,
src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (2)
132var property = (IPropertySymbol)symbol;
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (1)
182return typeMember is IPropertySymbol
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (2)
728var propertySymbol = symbol as IPropertySymbol;
src\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs (3)
69IPropertySymbol or 74var property = symbol as IPropertySymbol;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (13)
91return IsInterfacePropertyImplemented(classOrStructType, (IPropertySymbol)member); 103return IsAbstractPropertyImplemented(classOrStructType, (IPropertySymbol)member); 114private static bool IsInterfacePropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 128private static bool IsAbstractPropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 171IPropertySymbol property => property.ExplicitInterfaceImplementations.Length > 0, 214var property = (IPropertySymbol)member; 314var property = (IPropertySymbol)member; 413case IPropertySymbol property: 496var propertySymbol = (IPropertySymbol)symbol; 638IPropertySymbol { IsWithEvents: false } => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (2)
25public static IEnumerable<IPropertySymbol> GetIndexers(this INamespaceOrTypeSymbol? symbol) 29: symbol.GetMembers(WellKnownMemberNames.Indexer).OfType<IPropertySymbol>().Where(p => p.IsIndexer);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
23public static IPropertySymbol? GetAssociatedSynthesizedRecordProperty(this IParameterSymbol parameter, CancellationToken cancellationToken) 44if (member is IPropertySymbol { DeclaringSyntaxReferences.Length: > 0 } property &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IPropertySymbolExtensions.cs (1)
11public static IFieldSymbol? GetBackingFieldIfAny(this IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (14)
79IPropertySymbol property => property.OverriddenProperty, 89IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations), 256=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType(); 262=> symbol is IPropertySymbol { IsIndexer: true }; 268IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly, 273=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true }; 279IPropertySymbol propertySymbol => propertySymbol.Type, 362IPropertySymbol nt => nt.Parameters, 496public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol) 499return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName); 566IPropertySymbol propertySymbol => propertySymbol.Type, 620if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.IsCompleted && p.Type.SpecialType == SpecialType.System_Boolean && p.GetMethod != null)) 659if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null)) 699if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
84public override bool VisitProperty(IPropertySymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (1)
52if (symbol is IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ForEachSymbols.cs (2)
13public readonly IPropertySymbol CurrentProperty; 19IPropertySymbol currentProperty,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (2)
22var properties = symbol.GetMembers().OfType<IPropertySymbol>().ToImmutableArray(); 39var contextualProperties = contextualSymbol?.GetMembers().OfType<IPropertySymbol>().ToImmutableArray() ?? [];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
58/// <item>Two <see cref="IPropertySymbol"/>s are the "same" if they have
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (1)
49case IPropertySymbol property:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (9)
11private sealed class PropertySymbolKey : AbstractSymbolKey<IPropertySymbol> 15public sealed override void Create(IPropertySymbol symbol, SymbolKeyWriter visitor) 26SymbolKeyReader reader, IPropertySymbol? contextualSymbol, out string? failureReason) 36using var properties = GetMembersOfNamedType<IPropertySymbol>(containingTypeResolution, metadataName: null); 37using var result = PooledArrayBuilder<IPropertySymbol>.GetInstance(); 47IPropertySymbol? property = null; 71_ = reader.ReadSymbolKeyArray<IPropertySymbol, ITypeSymbol>( 91private static IPropertySymbol? Resolve( 94IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
461public override void VisitProperty(IPropertySymbol propertySymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (10)
42SymbolKind.Property => HaveSameSignature((IPropertySymbol)symbol1, (IPropertySymbol)symbol2, caseSensitive), 51public bool HaveSameSignature(IPropertySymbol property1, IPropertySymbol property2, bool caseSensitive) 156var property1 = (IPropertySymbol)symbol1; 157var property2 = (IPropertySymbol)symbol2; 173private static bool HaveSameAccessors(IPropertySymbol property1, IPropertySymbol property2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (2)
235private static bool IsPartialMethodDefinitionPart(IPropertySymbol symbol) 238private static bool IsPartialMethodImplementationPart(IPropertySymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (6)
130SymbolKind.Property => PropertiesAreEquivalent((IPropertySymbol)x, (IPropertySymbol)y, equivalentTypesWithDifferingAssemblies), 532var p1 = xMembersEnumerator.Current; 533var p2 = yMembersEnumerator.Current; 584private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
71SymbolKind.Property => CombineHashCodes((IPropertySymbol)x, currentHash), 239private int CombineHashCodes(IPropertySymbol x, int currentHash)
Microsoft.CodeAnalysis.CodeStyle.Fixes (64)
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
50if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
131if (!IsSymbolAccessible(((IPropertySymbol)symbol).SetMethod, document))
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
551else if (symbol is IPropertySymbol property)
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
46if (symbol is IPropertySymbol { SetMethod: { } setMethod } &&
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (1)
70internal async ValueTask<IPropertySymbol> GeneratePropertyAsync(
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (1)
74var propertySymbol = CodeGenerationSymbolFactory.CreatePropertySymbol(
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
34protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IPropertySymbol propertySymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
197out var identifierToken, out var propertySymbol, out var typeToGenerateIn))
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (3)
170IPropertySymbol property => GenerateProperty(compilation, property, throughMember, modifiers, accessibility, propertyGenerationBehavior), 195private IPropertySymbol GenerateProperty( 197IPropertySymbol property,
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (5)
33.OfType<IPropertySymbol>() 44ImmutableArray<IPropertySymbol> properties) 65bool IsAssignedToFieldOrProperty(ImmutableArray<IFieldSymbol> fields, ImmutableArray<IPropertySymbol> properties, IParameterSymbol parameter) 84bool IsAssignedToProperty(IPropertySymbol property, IParameterSymbol parameter) 135case IPropertySymbol propertySymbol:
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
299else if (member is IPropertySymbol property)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (5)
30IPropertySymbol property, 92IPropertySymbol property, 125IPropertySymbol property, 152IPropertySymbol property, 166IPropertySymbol property,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
57public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 86public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 127protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 150public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 348IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken), 366IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken), 411public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (7)
47internal static IPropertySymbol CreatePropertySymbol( 54ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, 82public static IPropertySymbol CreatePropertySymbol( 84ITypeSymbol type, RefKind refKind, ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, string name, 544internal static IPropertySymbol CreatePropertySymbol( 545IPropertySymbol property, 550ImmutableArray<IPropertySymbol> explicitInterfaceImplementations = default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (1)
51public static Task<Document> AddPropertyDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (3)
39SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 69TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 149Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertyInfo.cs (6)
13private static readonly ConditionalWeakTable<IPropertySymbol, CodeGenerationPropertyInfo> s_propertyToInfoMap = new(); 30IPropertySymbol property, 39private static CodeGenerationPropertyInfo GetInfo(IPropertySymbol property) 48public static SyntaxNode GetInitializer(IPropertySymbol property) 51public static bool GetIsNew(IPropertySymbol property) 54public static bool GetIsUnsafe(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (7)
24ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, 29IMethodSymbol setMethod) : CodeGenerationSymbol(containingType?.ContainingAssembly, containingType, attributes, declaredAccessibility, modifiers, name), IPropertySymbol 36public ImmutableArray<IPropertySymbol> ExplicitInterfaceImplementations { get; } = explicitInterfaceImplementations.NullToEmpty(); 73public new IPropertySymbol OriginalDefinition => this; 81public IPropertySymbol OverriddenProperty => null; 89public IPropertySymbol PartialImplementationPart => null; 91public IPropertySymbol PartialDefinitionPart => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (6)
15public static IPropertySymbol RenameParameters(this IPropertySymbol property, ImmutableArray<string> parameterNames) 40public static IPropertySymbol RemoveInaccessibleAttributesAndAttributesOfTypes( 41this IPropertySymbol property, ISymbol accessibleWithin, params INamedTypeSymbol[] attributesToRemove) 74public static bool IsWritableInConstructor(this IPropertySymbol property) 77private static bool ContainsBackingField(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (4)
91IPropertySymbol property => property.Type, 161else if (throughMember is IPropertySymbol { IsStatic: false, ExplicitInterfaceImplementations: [var explicitlyImplementedProperty, ..] }) 193IPropertySymbol property, ISymbol? throughMember, bool preferAutoProperties) 217IPropertySymbol property, ISymbol? throughMember, bool preferAutoProperties)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
445var property = propertyOperation.Property;
Microsoft.CodeAnalysis.CSharp (84)
Compilation\AwaitExpressionInfo.cs (2)
17public IPropertySymbol? IsCompletedProperty { get; } 23internal AwaitExpressionInfo(IMethodSymbol getAwaiter, IPropertySymbol isCompleted, IMethodSymbol getResult, bool isDynamic)
Compilation\CSharpSemanticModel.cs (14)
187internal abstract ImmutableArray<IPropertySymbol> GetIndexerGroupWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken)); 1135public ImmutableArray<IPropertySymbol> GetIndexerGroup(ExpressionSyntax expression, CancellationToken cancellationToken = default(CancellationToken)) 1141: ImmutableArray<IPropertySymbol>.Empty; 2295internal ImmutableArray<IPropertySymbol> GetIndexerGroupForNode( 2305return ImmutableArray<IPropertySymbol>.Empty; 3024public abstract IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3032public abstract IPropertySymbol GetDeclaredSymbol(IndexerDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)); 3105public abstract IPropertySymbol GetDeclaredSymbol(AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)); 4081private ImmutableArray<IPropertySymbol> GetIndexerGroupSemanticSymbols(BoundExpression boundNode, Binder binderOpt) 4089return ImmutableArray<IPropertySymbol>.Empty; 4099return ImmutableArray<IPropertySymbol>.Empty; 4108private static ImmutableArray<IPropertySymbol> FilterOverriddenOrHiddenIndexers(ArrayBuilder<ISymbol> symbols) 4141var builder = ArrayBuilder<IPropertySymbol>.GetInstance(); 4143foreach (IPropertySymbol indexer in symbols)
Compilation\ForEachStatementInfo.cs (2)
33public IPropertySymbol? CurrentProperty { get; } 68IPropertySymbol currentProperty,
Compilation\MemberSemanticModel.cs (4)
650public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 656public override IPropertySymbol GetDeclaredSymbol(IndexerDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1072public override IPropertySymbol GetDeclaredSymbol(AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1244internal override ImmutableArray<IPropertySymbol> GetIndexerGroupWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken))
Compilation\QueryClauseInfo.cs (1)
43/// <see cref="IFieldSymbol"/> or <see cref="IPropertySymbol"/> that return a delegate.
Compilation\SpeculativeSemanticModelWithMemberModel.cs (4)
305public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 310public override IPropertySymbol GetDeclaredSymbol(IndexerDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 425public override IPropertySymbol GetDeclaredSymbol(AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 465internal override ImmutableArray<IPropertySymbol> GetIndexerGroupWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (6)
406internal override ImmutableArray<IPropertySymbol> GetIndexerGroupWorker(CSharpSyntaxNode node, SymbolInfoOptions options, CancellationToken cancellationToken = default(CancellationToken)) 412return model == null ? ImmutableArray<IPropertySymbol>.Empty : model.GetIndexerGroupWorker(node, options, cancellationToken); 445public override IPropertySymbol GetDeclaredSymbol(AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1530public override IPropertySymbol GetDeclaredSymbol(PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1541public override IPropertySymbol GetDeclaredSymbol(IndexerDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 2061var property = (GetDeclaredSymbol(memberDecl, cancellationToken) as IPropertySymbol).GetSymbol();
CSharpExtensions.cs (5)
982public static ImmutableArray<IPropertySymbol> GetIndexerGroup(this SemanticModel? semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken = default(CancellationToken)) 991return ImmutableArray.Create<IPropertySymbol>(); 1427public static IPropertySymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, PropertyDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1436public static IPropertySymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, IndexerDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken)) 1454public static IPropertySymbol? GetDeclaredSymbol(this SemanticModel? semanticModel, AnonymousObjectMemberDeclaratorSyntax declaratorSyntax, CancellationToken cancellationToken = default(CancellationToken))
Operations\CSharpOperationFactory.cs (4)
616IPropertySymbol property = boundPropertyAccess.PropertySymbol.GetPublicSymbol(); 1648var lengthSymbol = Binder.GetPropertySymbol(boundIndexerAccess.LengthOrCountAccess, out _, out _).GetPublicSymbol(); 1735ImmutableArray<IPropertySymbol> initializedProperties = ImmutableArray.Create<IPropertySymbol>(boundPropertyEqualsValue.Property.GetPublicSymbol());
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
366var declaredAccessor = getSymbol ? (model.GetDeclaredSymbol(declarationWithExpressionBody, cancellationToken) as IPropertySymbol)?.GetMethod : null;
SymbolDisplay\SymbolDisplayVisitor.Members.cs (8)
89private static bool ShouldPropertyDisplayReadOnly(IPropertySymbol property) 113private static bool ShouldMethodDisplayReadOnly(IMethodSymbol method, IPropertySymbol? propertyOpt = null) 134public override void VisitProperty(IPropertySymbol symbol) 191private void AddPropertyNameAndParameters(IPropertySymbol symbol) 434var associatedProperty = (IPropertySymbol?)symbol.AssociatedSymbol; 925var isRequired = symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true }; 1018private void AddAccessor(IPropertySymbol property, IMethodSymbol? method, SyntaxKind keyword)
SymbolDisplay\SymbolDisplayVisitor.Types.cs (2)
465var members = string.Join(", ", symbol.GetMembers().OfType<IPropertySymbol>().Select(CreateAnonymousTypeMember)); 580private string CreateAnonymousTypeMember(IPropertySymbol property)
Symbols\PublicModel\PropertySymbol.cs (26)
26bool IPropertySymbol.IsIndexer 31ITypeSymbol IPropertySymbol.Type 44CodeAnalysis.NullableAnnotation IPropertySymbol.NullableAnnotation => _underlying.TypeWithAnnotations.ToPublicAnnotation(); 46ImmutableArray<IParameterSymbol> IPropertySymbol.Parameters 51IMethodSymbol IPropertySymbol.GetMethod 56IMethodSymbol IPropertySymbol.SetMethod 61IPropertySymbol IPropertySymbol.OriginalDefinition 69IPropertySymbol IPropertySymbol.OverriddenProperty 74ImmutableArray<IPropertySymbol> IPropertySymbol.ExplicitInterfaceImplementations 79bool IPropertySymbol.IsReadOnly 84bool IPropertySymbol.IsWriteOnly 89bool IPropertySymbol.IsWithEvents 94bool IPropertySymbol.IsRequired => _underlying.IsRequired; 96ImmutableArray<CustomModifier> IPropertySymbol.TypeCustomModifiers 101ImmutableArray<CustomModifier> IPropertySymbol.RefCustomModifiers 106bool IPropertySymbol.ReturnsByRef => _underlying.ReturnsByRef; 108bool IPropertySymbol.ReturnsByRefReadonly => _underlying.ReturnsByRefReadonly; 110RefKind IPropertySymbol.RefKind => _underlying.RefKind; 113IPropertySymbol? IPropertySymbol.PartialDefinitionPart => _underlying.PartialDefinitionPart.GetPublicSymbol(); 115IPropertySymbol? IPropertySymbol.PartialImplementationPart => _underlying.PartialImplementationPart.GetPublicSymbol(); 117bool IPropertySymbol.IsPartialDefinition => (_underlying as SourcePropertySymbol)?.IsPartialDefinition ?? false;
Symbols\SymbolExtensions.cs (5)
575internal static IPropertySymbol? GetPublicSymbol(this PropertySymbol? symbol) 577return symbol.GetPublicSymbol<IPropertySymbol>(); 709internal static ImmutableArray<IPropertySymbol> GetPublicSymbols(this ImmutableArray<PropertySymbol> symbols) 711return GetPublicSymbols<IPropertySymbol>(StaticCast<Symbol>.From(symbols)); 814internal static PropertySymbol? GetSymbol(this IPropertySymbol? symbol)
Microsoft.CodeAnalysis.CSharp.CodeStyle (26)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
109if (method.IsInitOnly && method.AssociatedSymbol is IPropertySymbol owningProperty) 187owningMethod.AssociatedSymbol is IPropertySymbol { DeclaringSyntaxReferences: [var reference, ..] } &&
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
447if (symbol is not IPropertySymbol and not IFieldSymbol) 458if (methodOrProperty is not IMethodSymbol and not IPropertySymbol) 1144if (emptySymbol is not IFieldSymbol and not IPropertySymbol)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (4)
85var arrayLengthProperty = TryGetNoArgInt32Property(arrayType, nameof(Array.Length)); 139OperationAnalysisContext context, InfoCache infoCache, IPropertySymbol arrayLengthProperty) 163IPropertySymbol? lengthLikeProperty, 215private static IPropertySymbol? TryGetLengthLikeProperty(InfoCache infoCache, IMethodSymbol? targetMethod)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (1)
75var lengthLikeProperty = TryGetLengthOrCountProperty(containingType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (2)
242var indexer = GetIndexer(targetMethod.ContainingType, infoCache.RangeType, targetMethod.ContainingType); 276private static bool IsWriteableIndexer(IInvocationOperation invocation, IPropertySymbol indexer)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (2)
129var lengthLikeProperty = TryGetLengthOrCountProperty(containingType); 148var indexer = GetIndexer(containingType, RangeType, containingType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (6)
18public static IPropertySymbol? TryGetLengthOrCountProperty(ITypeSymbol namedType) 26public static IPropertySymbol? TryGetNoArgInt32Property(ITypeSymbol type, string name) 28.OfType<IPropertySymbol>() 41public static bool IsInstanceLengthCheck(IPropertySymbol lengthLikeProperty, IOperation instance, IOperation operation) 127public static IPropertySymbol? GetIndexer(ITypeSymbol type, ITypeSymbol parameterType, ITypeSymbol returnType) 129.OfType<IPropertySymbol>()
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\MemberInfo.cs (2)
10IPropertySymbol lengthLikeProperty, 17public readonly IPropertySymbol LengthLikeProperty = lengthLikeProperty;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
93if (member is not IFieldSymbol and not IPropertySymbol) 181_candidateMembersToRemove.Any(kvp => kvp.Key is IPropertySymbol) && 182_candidateMembersToRemove.All(kvp => kvp.Key is IPropertySymbol))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
480public static IPropertySymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, PropertyDeclarationSyntax syntax, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (41)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
333(ConstructorDeclarationSyntax? constructor, ImmutableArray<IPropertySymbol> propertiesToAssign) TryFindPrimaryConstructor() 473ImmutableArray<IPropertySymbol> positionalParameters,
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
184ImmutableArray<IPropertySymbol> properties, 186out ImmutableArray<IPropertySymbol> orderedProperties) 243Property: IPropertySymbol referencedProperty 290ImmutableArray<IPropertySymbol> positionalParams) 317if (positionalParam is IPropertySymbol property) 362ImmutableArray<IPropertySymbol> positionalParams) 384Target: IPropertyReferenceOperation { Property: IPropertySymbol property }, 402ImmutableArray<IPropertySymbol> positionalParams, 451{ Instance: IInstanceReferenceOperation, Property: IPropertySymbol property } 1128IPropertySymbol prop => prop.GetBackingFieldIfAny(),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (3)
26IPropertySymbol Symbol, 74public static ImmutableArray<IPropertySymbol> GetInheritedPositionalParams( 118IPropertySymbol propertySymbol,
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
109where m is IFieldSymbol or IPropertySymbol
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
62if (fieldOrPropertySymbol is IPropertySymbol propertySymbol)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
202else if (symbol is IPropertySymbol { DeclaringSyntaxReferences.Length: > 0 } property)
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
217IPropertySymbol lengthLikeProperty, IOperation instance, ref IOperation rangeOperation)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
278IMethodSymbol or IPropertySymbol or IEventSymbol or IFieldSymbol =>
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (4)
133if (method.AssociatedSymbol is IPropertySymbol property) 189protected override TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 659if (method.AssociatedSymbol is IPropertySymbol property) 698IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (2)
81var members = GetMembers(namedType).Where(s => s.Kind != SymbolKind.Property || PropertyGenerator.CanBeGenerated((IPropertySymbol)s)) 122members = members.WhereAsArray(m => m is not IPropertySymbol and not IFieldSymbol || !primaryConstructor.Parameters.Any(static (p, m) => p.Name == m.Name, m));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (13)
26public static bool CanBeGenerated(IPropertySymbol property) 38IPropertySymbol property, 54IPropertySymbol property, 71IPropertySymbol property, 90IPropertySymbol property, 111IPropertySymbol property, CodeGenerationDestination destination, 139private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property) 261IPropertySymbol property, CodeGenerationDestination destination, 277IPropertySymbol property, 291IPropertySymbol property, 315IPropertySymbol property, 326IPropertySymbol property, 346IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
553var indexers = type.GetMembers().OfType<IPropertySymbol>() 1467case IPropertySymbol property:
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (13)
SymbolKey\SymbolKeyCompilationsTests.cs (7)
187var definition = type.GetMembers("Prop").First() as IPropertySymbol; 188var implementation = definition.PartialImplementationPart; 229var indexer1 = type.GetMembers().Where(m => m.MetadataName == "I.Item").Single() as IPropertySymbol; 230var indexer2 = type.GetMembers().Where(m => m.MetadataName == "I<T>.Item").Single() as IPropertySymbol;
SymbolKey\SymbolKeyMetadataVsSourceTests.cs (6)
77var member02 = (typesym.GetMembers("Prop").Single() as IPropertySymbol).Type; 86var member05 = (typesym.GetMembers(WellKnownMemberNames.Indexer).Single() as IPropertySymbol).Type; 364ResolveAndVerifyTypeSymbol(list[2], (originalSymbols[4] as IPropertySymbol).Type, model, comp20); 376ResolveAndVerifyTypeSymbol(list[4], (originalSymbols[0] as IPropertySymbol).Type, model, comp20); 439ResolveAndVerifyTypeSymbol(list[0], (originalSymbols[3] as IPropertySymbol).Type, model, comp20); 445ResolveAndVerifyTypeSymbol(list[1], (originalSymbols[2] as IPropertySymbol).Type, model, comp20);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (4)
CodeGen\CodeGenTupleTest.cs (2)
14284var p1Tuple = (INamedTypeSymbol)test.GetMember<IPropertySymbol>("P1").Type; 14291p1Tuple = (INamedTypeSymbol)((IPropertySymbol)symbolInfo.Symbol).Type;
CodeGen\IndexAndRangeTests.cs (2)
998var property = (IPropertySymbol)info.Symbol;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
FlowAnalysis\FlowTests.cs (1)
5842var property = declarations.Select(d => model.GetDeclaredSymbol(d)).Where(p => p.ContainingSymbol.Name == "Program").Single();
Semantics\RecordTests.cs (2)
901var x = (IPropertySymbol)c.GetMember("X");
Microsoft.CodeAnalysis.CSharp.Features (94)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
137.OfType<IPropertySymbol>().FirstOrDefault(p => p.GetMethod != null)?.Type;
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
229else if (member is IPropertySymbol { IsStatic: true, IsIndexer: false } property)
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.CompletionSymbolDisplay.cs (2)
21IPropertySymbol propertySymbol => ToDisplayString(propertySymbol), 29private static string ToDisplayString(IPropertySymbol symbol)
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
194var indexers = semanticModel.LookupSymbols(position, expressionType, WellKnownMemberNames.Indexer).OfType<IPropertySymbol>();
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (1)
201if (member is IPropertySymbol property && property.Parameters.Any(static p => !p.IsOptional))
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (2)
129IPropertySymbol property => property.Type, 152if (symbol.IsKind(SymbolKind.Property) && !((IPropertySymbol)symbol).IsWriteOnly)
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
37protected override async Task<string> GetFieldNameAsync(Document document, IPropertySymbol property, CancellationToken cancellationToken)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (14)
184=> member is IMethodSymbol { AssociatedSymbol: IPropertySymbol property } && property.IsSynthesizedAutoProperty(); 1114if (oldContainingMemberOrType is IPropertySymbol oldPropertySymbol && 1115newContainingMemberOrType is IPropertySymbol newPropertySymbol && 1129var oldSynthesizedAutoProperty = (IPropertySymbol?)oldSymbol?.ContainingType.GetMembers(oldSymbol.Name).FirstOrDefault(m => m.IsSynthesizedAutoProperty()); 1130var newSynthesizedAutoProperty = (IPropertySymbol?)newSymbol?.ContainingType.GetMembers(newSymbol.Name).FirstOrDefault(m => m.IsSynthesizedAutoProperty()); 1191if (oldSymbol is IPropertySymbol oldPropertySymbol && newSymbol is IPropertySymbol newPropertySymbol) 1335var oldGetterSymbol = ((IPropertySymbol?)oldSymbol)?.GetMethod; 1336var newGetterSymbol = ((IPropertySymbol?)newSymbol)?.GetMethod; 1978internal override string GetDisplayName(IPropertySymbol symbol) 1984MethodKind.PropertyGet => symbol.AssociatedSymbol is IPropertySymbol { IsIndexer: true } ? CSharpFeaturesResources.indexer_getter : CSharpFeaturesResources.property_getter, 1985MethodKind.PropertySet => symbol.AssociatedSymbol is IPropertySymbol { IsIndexer: true } ? CSharpFeaturesResources.indexer_setter : CSharpFeaturesResources.property_setter,
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
79IPropertySymbol propertySymbol => (propertySymbol.Type, propertySymbol.ReturnsByRef),
GenerateConstructorFromMembers\CSharpGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
56protected override IFieldSymbol? TryMapToWritableInstanceField(IPropertySymbol property, CancellationToken cancellationToken)
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (1)
65out SyntaxToken identifierToken, out IPropertySymbol propertySymbol, out INamedTypeSymbol typeToGenerateIn)
GenerateType\CSharpGenerateTypeService.cs (2)
804private static IPropertySymbol CreatePropertySymbol( 831out IPropertySymbol property)
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (1)
115if (memberWithName is IPropertySymbol { DeclaringSyntaxReferences: [var syntaxRef2, ..] } property &&
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (4)
104IPropertySymbol => GetAddContext<IPropertySymbol>(compilation, parameter, cancellationToken), 117if (fieldOrProperty is IPropertySymbol property) 218if (fieldOrProperty is IPropertySymbol property)
InitializeParameter\InitializeParameterHelpers.cs (1)
198public static bool IsThrowNotImplementedProperty(Compilation compilation, IPropertySymbol property, CancellationToken cancellationToken)
NavigationBar\CSharpNavigationBarItemService.cs (3)
81else if (member is IPropertySymbol { PartialImplementationPart: { } } propertySymbol) 86else if (member is IMethodSymbol or IPropertySymbol) 88Debug.Assert(member is IMethodSymbol { PartialDefinitionPart: null } or IPropertySymbol { PartialDefinitionPart: null },
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
116case IPropertySymbol:
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (2)
41IPropertySymbol property, 66IPropertySymbol property,
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
177var type = namedParameter is IFieldSymbol ? ((IFieldSymbol)namedParameter).Type : ((IPropertySymbol)namedParameter).Type;
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (6)
183out ImmutableArray<IPropertySymbol> indexers, out ITypeSymbol? expressionType) 186.OfType<IPropertySymbol>() 201out ImmutableArray<IPropertySymbol> indexers, out ITypeSymbol? expressionType) 220.OfType<IPropertySymbol>() 226IPropertySymbol indexer, 245IPropertySymbol indexer,
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
109if (method.IsInitOnly && method.AssociatedSymbol is IPropertySymbol owningProperty) 187owningMethod.AssociatedSymbol is IPropertySymbol { DeclaringSyntaxReferences: [var reference, ..] } &&
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
447if (symbol is not IPropertySymbol and not IFieldSymbol) 458if (methodOrProperty is not IMethodSymbol and not IPropertySymbol) 1144if (emptySymbol is not IFieldSymbol and not IPropertySymbol)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (4)
85var arrayLengthProperty = TryGetNoArgInt32Property(arrayType, nameof(Array.Length)); 139OperationAnalysisContext context, InfoCache infoCache, IPropertySymbol arrayLengthProperty) 163IPropertySymbol? lengthLikeProperty, 215private static IPropertySymbol? TryGetLengthLikeProperty(InfoCache infoCache, IMethodSymbol? targetMethod)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (1)
75var lengthLikeProperty = TryGetLengthOrCountProperty(containingType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (2)
242var indexer = GetIndexer(targetMethod.ContainingType, infoCache.RangeType, targetMethod.ContainingType); 276private static bool IsWriteableIndexer(IInvocationOperation invocation, IPropertySymbol indexer)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (2)
129var lengthLikeProperty = TryGetLengthOrCountProperty(containingType); 148var indexer = GetIndexer(containingType, RangeType, containingType);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (6)
18public static IPropertySymbol? TryGetLengthOrCountProperty(ITypeSymbol namedType) 26public static IPropertySymbol? TryGetNoArgInt32Property(ITypeSymbol type, string name) 28.OfType<IPropertySymbol>() 41public static bool IsInstanceLengthCheck(IPropertySymbol lengthLikeProperty, IOperation instance, IOperation operation) 127public static IPropertySymbol? GetIndexer(ITypeSymbol type, ITypeSymbol parameterType, ITypeSymbol returnType) 129.OfType<IPropertySymbol>()
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\MemberInfo.cs (2)
10IPropertySymbol lengthLikeProperty, 17public readonly IPropertySymbol LengthLikeProperty = lengthLikeProperty;
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
93if (member is not IFieldSymbol and not IPropertySymbol) 181_candidateMembersToRemove.Any(kvp => kvp.Key is IPropertySymbol) && 182_candidateMembersToRemove.All(kvp => kvp.Key is IPropertySymbol))
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (2)
333(ConstructorDeclarationSyntax? constructor, ImmutableArray<IPropertySymbol> propertiesToAssign) TryFindPrimaryConstructor() 473ImmutableArray<IPropertySymbol> positionalParameters,
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
184ImmutableArray<IPropertySymbol> properties, 186out ImmutableArray<IPropertySymbol> orderedProperties) 243Property: IPropertySymbol referencedProperty 290ImmutableArray<IPropertySymbol> positionalParams) 317if (positionalParam is IPropertySymbol property) 362ImmutableArray<IPropertySymbol> positionalParams) 384Target: IPropertyReferenceOperation { Property: IPropertySymbol property }, 402ImmutableArray<IPropertySymbol> positionalParams, 451{ Instance: IInstanceReferenceOperation, Property: IPropertySymbol property } 1128IPropertySymbol prop => prop.GetBackingFieldIfAny(),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (3)
26IPropertySymbol Symbol, 74public static ImmutableArray<IPropertySymbol> GetInheritedPositionalParams( 118IPropertySymbol propertySymbol,
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
109where m is IFieldSymbol or IPropertySymbol
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
62if (fieldOrPropertySymbol is IPropertySymbol propertySymbol)
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
202else if (symbol is IPropertySymbol { DeclaringSyntaxReferences.Length: > 0 } property)
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (1)
217IPropertySymbol lengthLikeProperty, IOperation instance, ref IOperation rangeOperation)
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
278IMethodSymbol or IPropertySymbol or IEventSymbol or IFieldSymbol =>
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
366var declaredAccessor = getSymbol ? (model.GetDeclaredSymbol(declarationWithExpressionBody, cancellationToken) as IPropertySymbol)?.GetMethod : null;
UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (1)
83IPropertySymbol propertySymbol,
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (103)
EditAndContinue\LineEditTests.cs (2)
1696semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod)]); 1905semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").GetMethod)]);
EditAndContinue\TopLevelEditingTests.cs (101)
2766SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), 2767SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), 2807SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), 2808SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), 2848SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), 2849SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), 3737SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), 3738SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3777expectedEdits.Add(SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod)); 3778expectedEdits.Add(SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod)); 3811SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), 3812SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 4276SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").GetMethod), 4277SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").SetMethod) 6974SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P1").GetMethod), 6975SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P1").SetMethod), 6976SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P2").GetMethod), 6977SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P2").SetMethod), 6978SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters[0].Type.Name == "Int32").GetMethod), 6979SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters[0].Type.Name == "Int32").SetMethod), 6980SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters[0].Type.Name == "Int32")), 6981SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters[0].Type.Name == "Byte").GetMethod), 6982SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters[0].Type.Name == "Byte").SetMethod), 6983SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters[0].Type.Name == "Byte")), 7228SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Char }])), 7229SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Char }]).GetMethod), 7230SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Char }]).SetMethod), 7236SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Byte }])), 7237SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Byte }]).GetMethod), 7238SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("C.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Byte }]).SetMethod), 7305SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 7306SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) 7326SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) 14752SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), 14771SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), 14809SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), 16465SemanticEdit(SemanticEditKind.Update, c => ((IPropertySymbol)c.GetMember<INamedTypeSymbol>("C").GetMembers("P").First()).GetMethod), 17728SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 17744SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod, preserveLocalVariables: false), 18356[SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod)], 18812SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod) 18833SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod) 18857SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod) 18872SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod) 18893SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod) 18908SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod) 18977SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 18978SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) 19000SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), 19001SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod) 19025SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 19026SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 19027SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), 19028SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod), 19051SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), 19052SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 19073semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod)]), 19153SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P2").GetMethod, preserveLocalVariables: false), 19154SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P3").SetMethod, preserveLocalVariables: false) 19307SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19313SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19358semanticEdits: [SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart)]), 19402semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C")]), 19430SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C"), 19459semanticEdits: [SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C")]), 19464SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C") 19494SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C") 19516SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19518SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C"), 19524SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 19526SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, partialType: "C"), 20130SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.this[]").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 20133SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IPropertySymbol>("C.this[]").PartialImplementationPart, partialType: "C"), 20140SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.this[]").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 20143SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IPropertySymbol>("C.this[]").PartialImplementationPart, partialType: "C"), 20248SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.this[]").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"), 20251SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<IPropertySymbol>("C.this[]").PartialImplementationPart, partialType: "C"), 20381[SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod)], 20571SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]")), 20572SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").GetMethod), 20573SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").SetMethod) 20595SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]")), 20596SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").GetMethod), 20597SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").SetMethod) 20621SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]")), 20622SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").GetMethod), 20623SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.this[]").SetMethod), 20647SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("S.this[]")), 20648SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("S.this[]").GetMethod) 20674SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Int32 }])), 20675SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_SByte }])), 20676SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Int32 }]).GetMethod), 20677SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_SByte }]).GetMethod), 20678SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_SByte }]).SetMethod), 20679SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_UInt32 }]).GetMethod), 20680SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Byte }]).SetMethod), 20681SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_UInt32 }]).SetMethod)); 20709SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_UInt32 }]).GetMethod), 20710SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Byte }]).SetMethod), 20711SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_Int32 }])), 20712SemanticEdit(SemanticEditKind.Update, c => c.GetMembers<IPropertySymbol>("S.this[]").Single(m => m.Parameters is [{ Type.SpecialType: SpecialType.System_SByte }])),
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (1)
IOperation\IOperationTests_IArgument.cs (1)
4156var indexerSymbol = operation.Property;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (30)
Semantics\InitOnlyMemberTests.cs (8)
50IPropertySymbol publicProperty = property.GetPublicSymbol(); 4260var i = s.GetMember<IPropertySymbol>("I"); 4299var i = s.GetMember<IPropertySymbol>("I"); 4339var i = s.GetMember<IPropertySymbol>("I"); 4381var i = s.GetMember<IPropertySymbol>("I"); 4404var i = s.GetMember<IPropertySymbol>("I"); 4435var i1 = s.GetMember<IPropertySymbol>("I1"); 4437var i2 = s.GetMember<IPropertySymbol>("I2");
Semantics\LocalFunctionTests.cs (2)
10181var property = (IPropertySymbol)symbol;
Semantics\NativeIntegerTests.cs (2)
336var property = (IPropertySymbol)underlyingMember;
Semantics\NullableReferenceTypesTests.cs (12)
158063Assert.Equal("object", ((IPropertySymbol)model.GetSymbolInfo(item).Symbol).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158066Assert.Equal("object", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158099Assert.Equal("object", ((IPropertySymbol)model.GetSymbolInfo(item).Symbol).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158232Assert.Equal("object", ((IPropertySymbol)model.GetSymbolInfo(item).Symbol).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158235Assert.Equal("object", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158275Assert.Equal("object", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158316Assert.Equal("object", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158351Assert.Equal("object", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158384Assert.Equal("object", ((IPropertySymbol)model.GetSymbolInfo(item).Symbol).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158527Assert.Equal("object!", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158571Assert.Equal("object!", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat)); 158608Assert.Equal("object!", ((IPropertySymbol)found).Type.ToDisplayString(TypeWithAnnotations.TestDisplayFormat));
Semantics\ReadOnlyStructsTests.cs (2)
1228static IPropertySymbol getProperty(INamedTypeSymbol symbol, string name) => (IPropertySymbol)symbol.GetMembers(name).Single();
Semantics\RecordStructTests.cs (4)
1764var x = (IPropertySymbol)c.GetMember("X"); 1811var x = (IPropertySymbol)c.GetMember("X");
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (65)
Compilation\CompilationAPITests.cs (6)
2611Assert.Equal(1, type.GetMembers().OfType<IPropertySymbol>().Count()); 2613Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 2632Assert.Equal(2, type.GetMembers().OfType<IPropertySymbol>().Count()); 2647Assert.Equal(2, type.GetMembers().OfType<IPropertySymbol>().Count()); 2649Assert.All(type.GetMembers().OfType<IPropertySymbol>().Select(p => p.Locations.FirstOrDefault()), 2714return type.GetMembers().OfType<IPropertySymbol>().SelectAsArray(p =>
Compilation\ForEachStatementInfoTests.cs (4)
40var cur1 = (IPropertySymbol)e1.GetMembers("Current").Single(); 47var cur2 = (IPropertySymbol)e2.GetMembers("Current").Single();
Compilation\GetSemanticInfoTests.cs (3)
2095Assert.True(members.SetEquals(typeParameter.AllEffectiveInterfacesNoUseSiteDiagnostics().Select(i => i.GetMember<IPropertySymbol>("P")))); 3917Assert.Equal(compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("IA").GetMember<IPropertySymbol>("P"), info.Symbol); 4485var propertyP = classNested.GetMember<IPropertySymbol>("P");
Compilation\SemanticModelAPITests.cs (2)
144var propertySymbol = (IPropertySymbol)symbolInfo.Symbol;
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (8)
303var propertySymbol = model.GetDeclaredSymbol(propertyDecl); 522var symbol = model.GetDeclaredSymbol(node); 544var symbol = model.GetDeclaredSymbol(node); 2861var explicitPropertySymbol = (IPropertySymbol)model.GetDeclaredSymbol(explicitPropertyNode); 3144var prop = typeA.GetMembers("Prop1").FirstOrDefault() as IPropertySymbol; 3152prop = typeA.GetMembers("Prop2").FirstOrDefault() as IPropertySymbol;
Compilation\SemanticModelGetSemanticInfoTests.cs (1)
4548Assert.True(symbol.ContainingSymbol.Kind == SymbolKind.Property && ((IPropertySymbol)symbol.ContainingSymbol).IsIndexer);
Compilation\SymbolVisitorTests.cs (3)
162public override void VisitProperty(IPropertySymbol symbol) 347public override string VisitProperty(IPropertySymbol symbol) 498public override int VisitProperty(IPropertySymbol symbol, StringBuilder argument)
DocumentationComments\CrefTests.cs (2)
3254Assert.True(((IPropertySymbol)info.CandidateSymbols[0]).IsIndexer); 6335var accessor = compilation.GlobalNamespace.GetMember<INamedTypeSymbol>("Outer").GetMember<INamedTypeSymbol>("Inner").GetMember<IPropertySymbol>("P").GetMethod;
SymbolDisplay\SymbolDisplayTests.cs (2)
5518var indexer = type.GetMembers().Where(m => m.Kind == SymbolKind.Property && ((IPropertySymbol)m).IsIndexer).Single(); 5722var indexer = type.GetMembers().Where(m => m.Kind == SymbolKind.Property && ((IPropertySymbol)m).IsIndexer).Single();
Symbols\AnonymousTypesSemanticsTests.cs (1)
2020var property = anonymousType.GetMember<IPropertySymbol>(fieldName);
Symbols\IndexerTests.cs (5)
2647Assert.True(indexerGroup.SetEquals(baseIndexerGroup.GetPublicSymbols(), EqualityComparer<IPropertySymbol>.Default)); 2651Assert.True(indexerGroup.SetEquals(derivedIndexerGroup.GetPublicSymbols(), EqualityComparer<IPropertySymbol>.Default)); 2725EqualityComparer<IPropertySymbol>.Default)); 2730EqualityComparer<IPropertySymbol>.Default)); 2735EqualityComparer<IPropertySymbol>.Default));
Symbols\Source\DeclaringSyntaxNodeTests.cs (6)
65var prop = symbol as IPropertySymbol; 276if (memb is IPropertySymbol) 376var propSymbol = model.GetDeclaredSymbol(propertyInitializer); 530var prop3 = c1.GetMembers("Prop3").Single() as IPropertySymbol;
Symbols\Source\NullablePublicAPITests.cs (13)
214return c.GetMembers().OfType<IPropertySymbol>().ToArray(); 2740Assert.Equal(PublicNullableAnnotation.Annotated, ((IPropertySymbol)symInfo.Symbol).NullableAnnotation); 2741Assert.Equal(PublicNullableAnnotation.Annotated, ((IPropertySymbol)symInfo.Symbol).Type.NullableAnnotation); 2745Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((IPropertySymbol)symInfo.Symbol).NullableAnnotation); 2746Assert.Equal(PublicNullableAnnotation.NotAnnotated, ((IPropertySymbol)symInfo.Symbol).Type.NullableAnnotation); 3265var propertySymbol = (IPropertySymbol)model.GetSymbolInfo(indexers[0]).Symbol; 3267propertySymbol = (IPropertySymbol)model.GetSymbolInfo(indexers[1]).Symbol; 3270void verifyIndexer(IPropertySymbol propertySymbol) 3316var propertySymbol = (IPropertySymbol)model.GetSymbolInfo(indexers[0]).Symbol; 3318propertySymbol = (IPropertySymbol)model.GetSymbolInfo(indexers[1]).Symbol; 3321void verifyIndexer(IPropertySymbol propertySymbol)
Symbols\SymbolEqualityTests.cs (4)
637var property1 = (IPropertySymbol)type1.GetMembers()[0]; 638var property2 = (IPropertySymbol)type2.GetMembers()[0];
Symbols\TypeTests.cs (5)
1690var memType = anonymousType.GetMember<IPropertySymbol>("p0").Type; 1695var nestedType = anonymousType.GetMember<IPropertySymbol>("p1").Type; 1698memType = nestedType.GetMember<IPropertySymbol>("p1").Type; 1712memType = nestedType.GetMember<IPropertySymbol>("local03").Type; 1722memType = anonymousType.GetMember<IPropertySymbol>("p").Type;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Extensions.cs (2)
758return ((IPropertySymbol)member).Parameters; 819return ((IPropertySymbol)symbol).Type;
Microsoft.CodeAnalysis.CSharp.Workspaces (26)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
203case IPropertySymbol:
Recommendations\CSharpRecommendationServiceRunner.cs (1)
876foreach (var member in container.RemoveNullableIfPresent().GetAccessibleMembersInThisAndBaseTypes<IPropertySymbol>(containingType))
Rename\CSharpRenameRewriterLanguageService.cs (2)
1081var property = (IPropertySymbol)symbol;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
480public static IPropertySymbol GetRequiredDeclaredSymbol(this SemanticModel semanticModel, PropertyDeclarationSyntax syntax, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (4)
133if (method.AssociatedSymbol is IPropertySymbol property) 189protected override TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) 659if (method.AssociatedSymbol is IPropertySymbol property) 698IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (2)
81var members = GetMembers(namedType).Where(s => s.Kind != SymbolKind.Property || PropertyGenerator.CanBeGenerated((IPropertySymbol)s)) 122members = members.WhereAsArray(m => m is not IPropertySymbol and not IFieldSymbol || !primaryConstructor.Parameters.Any(static (p, m) => p.Name == m.Name, m));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (13)
26public static bool CanBeGenerated(IPropertySymbol property) 38IPropertySymbol property, 54IPropertySymbol property, 71IPropertySymbol property, 90IPropertySymbol property, 111IPropertySymbol property, CodeGenerationDestination destination, 139private static TypeSyntax GenerateTypeSyntax(IPropertySymbol property) 261IPropertySymbol property, CodeGenerationDestination destination, 277IPropertySymbol property, 291IPropertySymbol property, 315IPropertySymbol property, 326IPropertySymbol property, 346IPropertySymbol property, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
553var indexers = type.GetMembers().OfType<IPropertySymbol>() 1467case IPropertySymbol property:
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (6)
CodeGeneration\SyntaxGeneratorTests.cs (6)
2496var property = type.GetMembers().Single(m => m is IPropertySymbol { IsIndexer: false }); 2497var indexer = type.GetMembers().Single(m => m is IPropertySymbol { IsIndexer: true }); 4279var indexer = symbolC.GetMembers().OfType<IPropertySymbol>().Single(m => m.IsIndexer); 4280var property = symbolC.GetMembers().OfType<IPropertySymbol>().Single(m => !m.IsIndexer);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeGeneration\CodeGenerationTests.cs (2)
417ImmutableArray<IPropertySymbol> explicitInterfaceImplementations = default, 478var property = CodeGenerationSymbolFactory.CreatePropertySymbol(
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
AbstractTypeParameterChecker.cs (1)
109public sealed override void VisitProperty(IPropertySymbol symbol)
Microsoft.CodeAnalysis.Features (192)
AddImport\SymbolReferenceFinder.cs (1)
330.Any(static (m, self) => (m is IFieldSymbol || m is IPropertySymbol) &&
Completion\Providers\AbstractContextVariableArgumentProvider.cs (1)
63else if (symbol.IsKind(SymbolKind.Property, out IPropertySymbol? property))
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
228if (symbol is IPropertySymbol && !existingTopLevelTags.Contains(ValueElementName))
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
155memberContainingDocument = await codeGenService.AddPropertyAsync(context, containingType, (IPropertySymbol)generatedMember, cancellationToken).ConfigureAwait(false);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
124else if (symbol is IPropertySymbol propertySymbol)
Completion\Providers\AbstractOverrideCompletionProvider.cs (1)
75SymbolKind.Property => ((IPropertySymbol)symbol).Type,
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (1)
108IPropertySymbol propertySymbol => propertySymbol.Type,
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (13)
55.OfType<IPropertySymbol>() 151ImmutableDictionary<IPropertySymbol, string> propertyMap, CancellationToken cancellationToken) 165if (semanticModel.GetSymbolInfo(identifier, cancellationToken).GetAnySymbol() is not IPropertySymbol symbol) 244ImmutableArray<IPropertySymbol> properties, 320private static (ImmutableArray<IPropertySymbol> properties, ImmutableDictionary<IPropertySymbol, string> propertyMap) GenerateProperties( 323var originalProperties = anonymousType.GetMembers().OfType<IPropertySymbol>().ToImmutableArray(); 329var builder = ImmutableDictionary.CreateBuilder<IPropertySymbol, string>(); 332var originalProperty = originalProperties[i]; 342private static IPropertySymbol GenerateProperty(Document document, IPropertySymbol prop) 370private static IMethodSymbol CreateAccessorSymbol(IPropertySymbol prop, MethodKind kind) 378ImmutableArray<IPropertySymbol> properties, SyntaxGenerator generator)
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (4)
25protected abstract Task<string> GetFieldNameAsync(Document document, IPropertySymbol propertySymbol, CancellationToken cancellationToken); 43if (semanticModel.GetDeclaredSymbol(property) is not IPropertySymbol propertySymbol) 57internal static bool IsValidAutoProperty(IPropertySymbol propertySymbol) 76IPropertySymbol propertySymbol,
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (5)
287var currentProperty = TryFindMemberInThisOrBaseTypes<IPropertySymbol>( 508.GetAccessibleMembersInThisAndBaseTypes<IPropertySymbol>(containingType) 518indexer = interfaces.SelectMany(i => i.GetMembers().OfType<IPropertySymbol>().Where(IsViableIndexer)).FirstOrDefault(); 533private static bool IsViableIndexer(IPropertySymbol property)
Debugging\AbstractBreakpointResolver.cs (2)
233SymbolKind.Property => ((IPropertySymbol)symbol).PartialImplementationPart, 288IPropertySymbol property => property.Parameters.Length != parameterCount,
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (8)
328SymbolKind.Property => GetDisplayName((IPropertySymbol)symbol), 336internal virtual string GetDisplayName(IPropertySymbol symbol) 2384protected static bool ReturnTypesEquivalent(IPropertySymbol oldProperty, IPropertySymbol newProperty, bool exact) 2446var oldProperty = (IPropertySymbol)oldMember; 2447var newProperty = (IPropertySymbol)newMember;
EditAndContinue\Utilities\Extensions.cs (8)
141public static bool IsSynthesizedAutoProperty(this IPropertySymbol property) 145=> symbol is IPropertySymbol property && property.IsSynthesizedAutoProperty(); 167=> symbol is IPropertySymbol property && IsAutoProperty(property); 169public static bool IsAutoProperty(this IPropertySymbol property) 217=> symbol is IMethodSymbol { IsPartialDefinition: true } or IPropertySymbol { IsPartialDefinition: true }; 220=> symbol is IMethodSymbol { PartialDefinitionPart: not null } or IPropertySymbol { PartialDefinitionPart: not null }; 226IPropertySymbol { PartialDefinitionPart: var def } => def, 234IPropertySymbol { PartialImplementationPart: var impl } => impl,
EmbeddedLanguages\EmbeddedLanguageDetector.cs (1)
335return symbol is IFieldSymbol or IPropertySymbol &&
EncapsulateField\AbstractEncapsulateFieldService.cs (3)
209var generatedProperty = GenerateProperty( 319IPropertySymbol property, 336protected static IPropertySymbol GenerateProperty(
ExtractInterface\AbstractExtractInterfaceService.cs (4)
403var property = member as IPropertySymbol; 451var prop = m as IPropertySymbol;
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs (1)
61protected abstract IFieldSymbol? TryMapToWritableInstanceField(IPropertySymbol property, CancellationToken cancellationToken);
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (1)
91if (symbol is IPropertySymbol property)
GenerateFromMembers\AbstractGenerateFromMembersCodeRefactoringProvider.cs (3)
64IPropertySymbol property => IsViableProperty(property) && !property.IsWriteOnly, 73IPropertySymbol property => IsViableProperty(property) && property.IsWritableInConstructor(), 80private static bool IsViableProperty(IPropertySymbol property)
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
627else if (symbol is IPropertySymbol property)
GenerateType\AbstractGenerateTypeService.GenerateNamedType.cs (2)
178if (_service.TryGenerateProperty(property, _semanticDocument.SemanticModel, typeInference, _cancellationToken, out var generatedProperty)) 331internal abstract bool TryGenerateProperty(TSimpleNameSyntax propertyName, SemanticModel semanticModel, ITypeInferenceService typeInference, CancellationToken cancellationToken, out IPropertySymbol property);
GoToDefinition\GoToDefinitionFeatureHelpers.cs (1)
50symbol = (symbol as IPropertySymbol)?.PartialImplementationPart ?? symbol;
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
75if (symbol is IEventSymbol or IPropertySymbol
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
67if (symbol is IEventSymbol or IPropertySymbol or IMethodSymbol) 590if (memberSymbol is IMethodSymbol or IEventSymbol or IPropertySymbol) 623if (memberSymbol is IMethodSymbol or IEventSymbol or IPropertySymbol
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (6)
200var property = CreateProperty(parameter, accessibilityModifiersRequired, rules); 313private IPropertySymbol CreateProperty( 460if (fieldOrProperty is IPropertySymbol property) 464codeGenerator.GetInfo(GetAddContext<IPropertySymbol>(parameter, blockStatement, typeDeclaration, cancellationToken), options, root.SyntaxTree.Options), 710if (memberWithName is IPropertySymbol property && 748bool IsThrowNotImplementedProperty(IPropertySymbol property)
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
230if (memberReference.Member is IFieldSymbol or IPropertySymbol)
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.cs (1)
162else if (symbol is IPropertySymbol property)
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.StructuralTypeCollectorVisitor.cs (1)
119public override void VisitProperty(IPropertySymbol symbol)
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (2)
347else if (symbol is IPropertySymbol property) 678protected void AddDescriptionForProperty(IPropertySymbol symbol)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
51SymbolKind.Property => new WrappedPropertySymbol((IPropertySymbol)m, canImplementImplicitly, docCommentFormattingService),
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (8)
14private sealed class WrappedPropertySymbol(IPropertySymbol propertySymbol, bool canImplementImplicitly, IDocumentationCommentFormattingService docCommentFormattingService) : AbstractWrappedSymbol(propertySymbol, canImplementImplicitly, docCommentFormattingService), IPropertySymbol 16private readonly IPropertySymbol _symbol = propertySymbol; 18public ImmutableArray<IPropertySymbol> ExplicitInterfaceImplementations 46public IPropertySymbol OverriddenProperty => _symbol.OverriddenProperty; 62public new IPropertySymbol OriginalDefinition 70public IPropertySymbol PartialDefinitionPart => _symbol.PartialDefinitionPart; 72public IPropertySymbol PartialImplementationPart => _symbol.PartialImplementationPart;
PullMemberUp\MembersPuller.cs (2)
153if (member is IPropertySymbol propertySymbol) 453else if (member is IPropertySymbol propertySymbol)
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
75public override bool VisitProperty(IPropertySymbol symbol)
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (4)
30Document document, IPropertySymbol property, SyntaxNode propertyDeclaration, IFieldSymbol propertyBackingField, string desiredGetMethodName, string desiredSetMethodName, CancellationToken cancellationToken); 57IPropertySymbol property, IFieldSymbol propertyBackingField, 81private readonly IPropertySymbol _property; 98IPropertySymbol property,
ReplacePropertyWithMethods\IReplacePropertyWithMethodsService.cs (2)
24IPropertySymbol property, IFieldSymbol propertyBackingField, 30IPropertySymbol property, SyntaxNode propertyDeclaration,
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (33)
31IEqualityComparer<(IPropertySymbol property, ReferenceLocation location)> 54var propertySymbol = semanticModel.GetDeclaredSymbol(propertyDeclaration) as IPropertySymbol; 77IPropertySymbol propertySymbol, 96where r.Definition is IPropertySymbol 98select (property: (IPropertySymbol)r.Definition, location: loc); 119private static ImmutableDictionary<IPropertySymbol, IFieldSymbol?> CreateDefinitionToBackingFieldMap(IEnumerable<ReferencedSymbol> propertyReferences) 121var definitionToBackingField = ImmutableDictionary.CreateBuilder<IPropertySymbol, IFieldSymbol?>(SymbolEquivalenceComparer.Instance); 125if (reference.Definition is IPropertySymbol property) 135private static bool HasAnyMatchingGetOrSetMethods(IPropertySymbol property, string name) 141private static bool HasAnyMatchingGetMethods(IPropertySymbol property, string name) 149private static bool HasAnyMatchingSetMethods(IPropertySymbol property, string name) 160private static IFieldSymbol? GetBackingField(IPropertySymbol property) 200ILookup<Document, (IPropertySymbol property, ReferenceLocation location)> referencesByDocument, 201ImmutableDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField, 220IEnumerable<(IPropertySymbol property, ReferenceLocation location)> references, 221ImmutableDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField, 241IEnumerable<(IPropertySymbol property, ReferenceLocation location)> references, 242IDictionary<IPropertySymbol, IFieldSymbol?> propertyToBackingField, 300ImmutableDictionary<IPropertySymbol, IFieldSymbol?> definitionToBackingField, 318private static async Task<MultiDictionary<DocumentId, IPropertySymbol>> GetDefinitionsByDocumentIdAsync( 323var result = new MultiDictionary<DocumentId, IPropertySymbol>(); 328var definition = referencedSymbol.Definition as IPropertySymbol; 349MultiDictionary<DocumentId, IPropertySymbol>.ValueSet originalDefinitions, 350IDictionary<IPropertySymbol, IFieldSymbol?> definitionToBackingField, 397private static async Task<ImmutableArray<(IPropertySymbol property, SyntaxNode declaration)>> GetCurrentPropertiesAsync( 401MultiDictionary<DocumentId, IPropertySymbol>.ValueSet originalDefinitions, 404using var _ = ArrayBuilder<(IPropertySymbol property, SyntaxNode declaration)>.GetInstance(out var result); 420IPropertySymbol? property, CancellationToken cancellationToken) 436public bool Equals((IPropertySymbol property, ReferenceLocation location) x, (IPropertySymbol property, ReferenceLocation location) y) 442public int GetHashCode((IPropertySymbol property, ReferenceLocation location) obj)
RQName\RQNodeBuilder.cs (2)
27IPropertySymbol propertySymbol => BuildProperty(propertySymbol), 99private static RQProperty? BuildProperty(IPropertySymbol symbol)
Shared\Extensions\ISymbolExtensions_2.cs (2)
136var propertySymbol = (IPropertySymbol)symbol;
Shared\Extensions\ISymbolExtensions_Sorting.cs (4)
104private static int CompareProperties(IPropertySymbol xProperty, string[] xTypeNames, IPropertySymbol yProperty, string[] yTypeNames) 182? CompareProperties((IPropertySymbol)s1, symbol1ParameterTypeNames, (IPropertySymbol)s2, symbol2ParameterTypeNames)
Shared\Utilities\ExtractTypeHelpers.cs (2)
211var property = member as IPropertySymbol;
Snippets\SnippetProviders\AbstractForLoopSnippetProvider.cs (4)
30protected static IPropertySymbol? FindLengthProperty(ITypeSymbol type, Compilation compilation) 33protected static IPropertySymbol? FindCountProperty(ITypeSymbol type, Compilation compilation) 36private static IPropertySymbol? FindAccessibleIntegerProperty(ITypeSymbol type, Compilation compilation, string propertyName) 39.GetAccessibleMembersInThisAndBaseTypes<IPropertySymbol>(propertyName, compilation.Assembly)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (8)
105private readonly HashSet<IPropertySymbol> _propertiesWithShadowGetAccessorUsages = []; 358if (memberSymbol is IPropertySymbol propertySymbol) 508member is IPropertySymbol property && 517member is IPropertySymbol { GetMethod: not null, SetMethod: not null } property2 && 563case IPropertySymbol when isConvertibleProperty: 680case IPropertySymbol or IFieldSymbol: 835return ((IPropertySymbol)memberSymbol).ExplicitInterfaceImplementations.IsEmpty; 866methodSymbol.ContainingType.GetMembers(suffix).Any(static m => m is IPropertySymbol);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (3)
345if (semanticModel.GetDeclaredSymbol(propertyDeclaration, cancellationToken) is not IPropertySymbol property) 496protected virtual bool CanConvert(IPropertySymbol property) 545using var _2 = PooledHashSet<IPropertySymbol>.GetInstance(out var reportedProperties);
src\Analyzers\Core\Analyzers\UseAutoProperty\AnalysisResult.cs (1)
32IPropertySymbol Property,
src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (2)
132var property = (IPropertySymbol)symbol;
src\Analyzers\Core\Analyzers\UseObjectInitializer\UseNamedMemberInitializerAnalyzer.cs (1)
182return typeMember is IPropertySymbol
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
50if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
131if (!IsSymbolAccessible(((IPropertySymbol)symbol).SetMethod, document))
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (1)
551else if (symbol is IPropertySymbol property)
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
46if (symbol is IPropertySymbol { SetMethod: { } setMethod } &&
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateParameterizedMemberService.SignatureInfo.cs (1)
70internal async ValueTask<IPropertySymbol> GeneratePropertyAsync(
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.CodeAction.cs (1)
74var propertySymbol = CodeGenerationSymbolFactory.CreatePropertySymbol(
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.cs (1)
34protected abstract bool TryInitializeExplicitInterfaceState(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IPropertySymbol propertySymbol, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
197out var identifierToken, out var propertySymbol, out var typeToGenerateIn))
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (3)
170IPropertySymbol property => GenerateProperty(compilation, property, throughMember, modifiers, accessibility, propertyGenerationBehavior), 195private IPropertySymbol GenerateProperty( 197IPropertySymbol property,
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (5)
33.OfType<IPropertySymbol>() 44ImmutableArray<IPropertySymbol> properties) 65bool IsAssignedToFieldOrProperty(ImmutableArray<IFieldSymbol> fields, ImmutableArray<IPropertySymbol> properties, IParameterSymbol parameter) 84bool IsAssignedToProperty(IPropertySymbol property, IParameterSymbol parameter) 135case IPropertySymbol propertySymbol:
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator.cs (1)
299else if (member is IPropertySymbol property)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (5)
30IPropertySymbol property, 92IPropertySymbol property, 125IPropertySymbol property, 152IPropertySymbol property, 166IPropertySymbol property,
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (2)
728var propertySymbol = symbol as IPropertySymbol;
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (6)
56IPropertySymbol propertySymbol, 188property = (IPropertySymbol?)property.GetSymbolKey(cancellationToken).Resolve(compilation, cancellationToken: cancellationToken).Symbol; 271private async Task<(IFieldSymbol? fieldSymbol, IPropertySymbol? propertySymbol)> MapDiagnosticToCurrentSolutionAsync( 292var propertySymbol = (IPropertySymbol)propertySemanticModel.GetRequiredDeclaredSymbol(property, cancellationToken); 303propertySymbol = propertySymbol.GetSymbolKey(cancellationToken).Resolve(currentCompilation, cancellationToken: cancellationToken).GetAnySymbol() as IPropertySymbol;
ValueTracking\ValueTracker.cs (2)
29is IPropertySymbol 86case IPropertySymbol:
ValueTracking\ValueTracker.FindReferencesProgress.cs (1)
92else if (symbol is IPropertySymbol { IsIndexer: true } propertySymbol)
Microsoft.CodeAnalysis.Features.UnitTests (2)
FindUsages\DefinitionItemFactoryTests.cs (2)
1148var p = compilation.GetMember<IPropertySymbol>("C.P"); 1205var p = compilation.GetMember<IPropertySymbol>("C.P");
Microsoft.CodeAnalysis.Test.Utilities (3)
Compilation\OperationTreeVerifier.cs (1)
1585foreach (var property in operation.InitializedProperties)
Compilation\TestOperationVisitor.cs (2)
1122foreach (var property in operation.InitializedProperties) 1537case IPropertySymbol prop:
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\OperationTests.cs (1)
186ImmutableArray<IPropertySymbol>.Empty, ImmutableArray<ILocalSymbol>.Empty,
Microsoft.CodeAnalysis.VisualBasic (57)
Binding\MemberSemanticModel.vb (1)
618Public Overrides Function GetDeclaredSymbol(fieldInitializerSyntax As FieldInitializerSyntax, Optional cancellationToken As System.Threading.CancellationToken = Nothing) As IPropertySymbol
Compilation\AwaitExpressionInfo.vb (3)
19Friend Sub New(getAwaiter As IMethodSymbol, isCompleted As IPropertySymbol, getResult As IMethodSymbol) 26Private ReadOnly _isCompleted As IPropertySymbol 50Public ReadOnly Property IsCompletedProperty As IPropertySymbol
Compilation\ForEachStatementInfo.vb (2)
24Public ReadOnly Property CurrentProperty As IPropertySymbol 65currentProperty As IPropertySymbol,
Compilation\SemanticModel.vb (3)
2442Public Overridable Overloads Function GetDeclaredSymbol(fieldInitializerSyntax As FieldInitializerSyntax, Optional cancellationToken As CancellationToken = Nothing) As IPropertySymbol 2677Public Overloads Function GetDeclaredSymbol(declarationSyntax As PropertyStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IPropertySymbol 2695Public Overloads Function GetDeclaredSymbol(declarationSyntax As PropertyBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As IPropertySymbol
Compilation\SpeculativeSemanticModelWithMemberModel.vb (1)
193Public Overrides Function GetDeclaredSymbol(fieldInitializerSyntax As FieldInitializerSyntax, Optional cancellationToken As System.Threading.CancellationToken = Nothing) As IPropertySymbol
Compilation\SyntaxTreeSemanticModel.vb (1)
1230Public Overrides Function GetDeclaredSymbol(fieldInitializerSyntax As FieldInitializerSyntax, Optional cancellationToken As System.Threading.CancellationToken = Nothing) As IPropertySymbol
Operations\VisualBasicOperationFactory.vb (7)
880Dim [property] As IPropertySymbol = boundPropertyAccess.PropertySymbol 999Dim initializedProperties As ImmutableArray(Of IPropertySymbol) = boundPropertyInitializer.InitializedProperties.As(Of IPropertySymbol) 1606Dim [property] As IPropertySymbol = DirectCast(boundAnonymousTypePropertyAccess.ExpressionSymbol, IPropertySymbol) 1610Private Function CreateBoundAnonymousTypePropertyAccessOperation(boundAnonymousTypePropertyAccess As BoundAnonymousTypePropertyAccess, [property] As IPropertySymbol) As IPropertyReferenceOperation 1619Private Function CreateAnonymousTypePropertyAccessImplicitReceiverOperation(propertySym As IPropertySymbol, syntax As SyntaxNode) As InstanceReferenceOperation
Operations\VisualBasicOperationFactory_Methods.vb (1)
320Dim [property] As IPropertySymbol = properties(i)
SymbolDisplay\SymbolDisplayVisitor.Members.vb (1)
62Public Overrides Sub VisitProperty(symbol As IPropertySymbol)
SymbolDisplay\SymbolDisplayVisitor.Types.vb (3)
326Dim members = String.Join(", ", symbol.GetMembers().OfType(Of IPropertySymbol).Select(Function(p) CreateAnonymousTypeMember(p))) 408Private Function CreateAnonymousTypeMember(prop As IPropertySymbol) As String 413Private Function CreateAnonymousTypeMemberWorker(prop As IPropertySymbol) As String
Symbols\HandledEvent.vb (2)
70Public ReadOnly Property EventContainer As IPropertySymbol 76Public ReadOnly Property WithEventsSourceProperty As IPropertySymbol
Symbols\PropertySymbol.vb (27)
103Public MustOverride ReadOnly Property IsDefault As Boolean Implements IPropertySymbol.IsIndexer 108Public Overridable ReadOnly Property IsReadOnly As Boolean Implements IPropertySymbol.IsReadOnly 127Public Overridable ReadOnly Property IsWriteOnly As Boolean Implements IPropertySymbol.IsWriteOnly 476Public Overridable ReadOnly Property IsWithEvents As Boolean Implements IPropertySymbol.IsWithEvents 538Private ReadOnly Property IPropertySymbol_ExplicitInterfaceImplementations As ImmutableArray(Of IPropertySymbol) Implements IPropertySymbol.ExplicitInterfaceImplementations 540Return ImmutableArrayExtensions.Cast(Of PropertySymbol, IPropertySymbol)(Me.ExplicitInterfaceImplementations) 544Private ReadOnly Property IPropertySymbol_GetMethod As IMethodSymbol Implements IPropertySymbol.GetMethod 550Private ReadOnly Property IPropertySymbol_OriginalDefinition As IPropertySymbol Implements IPropertySymbol.OriginalDefinition 556Private ReadOnly Property IPropertySymbol_OverriddenProperty As IPropertySymbol Implements IPropertySymbol.OverriddenProperty 562Private ReadOnly Property IPropertySymbol_Parameters As ImmutableArray(Of IParameterSymbol) Implements IPropertySymbol.Parameters 568Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod 574Private ReadOnly Property IPropertySymbol_IsRequired As Boolean Implements IPropertySymbol.IsRequired 580Private ReadOnly Property IPropertySymbol_ReturnsByRef As Boolean Implements IPropertySymbol.ReturnsByRef 586Private ReadOnly Property IPropertySymbol_ByRefReturnIsReadonly As Boolean Implements IPropertySymbol.ReturnsByRefReadonly 592Private ReadOnly Property IPropertySymbol_RefKind As RefKind Implements IPropertySymbol.RefKind 598Private ReadOnly Property IPropertySymbol_Type As ITypeSymbol Implements IPropertySymbol.Type 604Private ReadOnly Property IPropertySymbol_NullableAnnotation As NullableAnnotation Implements IPropertySymbol.NullableAnnotation 610Private ReadOnly Property IPropertySymbol_RefCustomModifiers As ImmutableArray(Of CustomModifier) Implements IPropertySymbol.RefCustomModifiers 616Private ReadOnly Property IPropertySymbol_TypeCustomModifiers As ImmutableArray(Of CustomModifier) Implements IPropertySymbol.TypeCustomModifiers 622Private ReadOnly Property IPropertySymbol_PartialDefinitionPart As IPropertySymbol Implements IPropertySymbol.PartialDefinitionPart 629Private ReadOnly Property IPropertySymbol_PartialImplementationPart As IPropertySymbol Implements IPropertySymbol.PartialImplementationPart 636Private ReadOnly Property IPropertySymbol_IsPartialDefinition As Boolean Implements IPropertySymbol.IsPartialDefinition
VisualBasicExtensions.vb (5)
559Public Function IsOverloads(propertySymbol As IPropertySymbol) As Boolean 565Public Function IsDefault(propertySymbol As IPropertySymbol) As Boolean 876Public Function GetDeclaredSymbol(semanticModel As SemanticModel, fieldInitializerSyntax As FieldInitializerSyntax, Optional cancellationToken As CancellationToken = Nothing) As IPropertySymbol 1149Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As PropertyStatementSyntax, Optional cancellationToken As CancellationToken = Nothing) As IPropertySymbol 1175Public Function GetDeclaredSymbol(semanticModel As SemanticModel, declarationSyntax As PropertyBlockSyntax, Optional cancellationToken As CancellationToken = Nothing) As IPropertySymbol
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (4)
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (1)
60Protected Overrides Function CanConvert(prop As IPropertySymbol) As Boolean
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (3)
304ElseIf TypeOf symbol Is IPropertySymbol Then 305Dim prop = DirectCast(symbol, IPropertySymbol) 513Not symbolInfo.GetBestOrAllSymbols().OfType(Of IPropertySymbol)().Any()
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (16)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (10)
21[property] As IPropertySymbol, 33[property] As IPropertySymbol, 46Public Function GeneratePropertyDeclaration([property] As IPropertySymbol, 61Private Function GeneratePropertyDeclarationWorker([property] As IPropertySymbol, 100Private Function GeneratePropertyParameterList([property] As IPropertySymbol, options As CodeGenerationContextInfo) As ParameterListSyntax 108Private Function GenerateAccessorList([property] As IPropertySymbol, 119Private Function GenerateAccessor([property] As IPropertySymbol, 156Private Function GenerateAccessorModifiers([property] As IPropertySymbol, 174[property] As IPropertySymbol, 236Private Function GenerateAsClause([property] As IPropertySymbol, options As CodeGenerationContextInfo) As AsClauseSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
120[property] As IPropertySymbol, 566Public Overrides Function CreatePropertyDeclaration([property] As IPropertySymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\SymbolExtensions.vb (1)
28Dim type = DirectCast(symbol, IPropertySymbol).Type
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (2)
374Dim properties = symbols.OfType(Of IPropertySymbol)() 770TryCast(memberSymbol, IPropertySymbol)?.Type)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\SymbolExtensions.vb (1)
16Dim propertySymbol = DirectCast(symbol, IPropertySymbol)
Microsoft.CodeAnalysis.VisualBasic.Features (44)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (1)
345Dim withEventsProperty = TryCast(semanticModel.GetSymbolInfo(handlesClauseItem.EventContainer, cancellationToken).Symbol, IPropertySymbol)
CodeLens\VisualBasicDisplayInfoService.vb (1)
100Dim propertySymbol = TryCast(methodSymbol.AssociatedSymbol, IPropertySymbol)
Completion\CompletionProviders\EnumCompletionProvider.vb (1)
94TryCast(symbol, IPropertySymbol)?.Type)))
Completion\CompletionProviders\HandlesClauseCompletionProvider.vb (2)
133Dim type = TryCast(symbolInfo.Symbol, IPropertySymbol)?.Type 146Dim [property] = TryCast(s, IPropertySymbol)
Completion\CompletionProviders\ImplementsClauseCompletionProvider.vb (1)
130Dim [property] = TryCast(symbol, IPropertySymbol)
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (3)
177SpecializedCollections.EmptyList(Of IPropertySymbol), 178semanticModel.LookupSymbols(position, expressionType, includeReducedExtensionMethods:=True).OfType(Of IPropertySymbol).Where(Function(p) p.IsIndexer).ToList()) 183Dim propertyParameters = accessibleMembers.OfType(Of IPropertySymbol).Select(Function(p) p.Parameters.As(Of ISymbol)())
Completion\CompletionProviders\ObjectInitializerCompletionProvider.vb (1)
123Dim [property] = TryCast(member, IPropertySymbol)
ConvertAutoPropertyToFullProperty\VisualBasicConvertAutoPropertyToFullProperty.vb (1)
34Protected Overrides Function GetFieldNameAsync(document As Document, propertySymbol As IPropertySymbol, cancellationToken As CancellationToken) As Task(Of String)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (5)
777Dim oldPropertySymbol = TryCast(oldContainingMemberOrType, IPropertySymbol) 778Dim newPropertySymbol = TryCast(newContainingMemberOrType, IPropertySymbol) 826Dim oldPropertySymbol = TryCast(oldSymbol, IPropertySymbol) 827Dim newPropertySymbol = TryCast(newSymbol, IPropertySymbol) 1450Friend Overrides Function GetDisplayName(symbol As IPropertySymbol) As String
ExtractMethod\VisualBasicSelectionResult.vb (1)
179Dim propertySymbol = TryCast(symbol, IPropertySymbol)
GenerateConstructorFromMembers\VisualBasicGenerateConstructorFromMembersCodeRefactoringProvider.vb (1)
47Protected Overrides Function TryMapToWritableInstanceField([property] As IPropertySymbol, cancellationToken As CancellationToken) As IFieldSymbol
GenerateMember\GenerateVariable\VisualBasicGenerateVariableService.vb (2)
34ByRef identifierToken As SyntaxToken, ByRef propertySymbol As IPropertySymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean 51propertySymbol = DirectCast(semanticModel.GetDeclaredSymbol(propertyNode, cancellationToken), IPropertySymbol)
GenerateType\VisualBasicGenerateTypeService.vb (2)
690Private Shared Function GenerateProperty(propertyName As SimpleNameSyntax, typeSymbol As ITypeSymbol) As IPropertySymbol 709ByRef propertySymbol As IPropertySymbol) As Boolean
InlineHints\VisualBasicInlineParameterNameHintsService.vb (1)
95Dim propertySymbol = TryCast(parameter.ContainingSymbol, IPropertySymbol)
NavigationBar\VisualBasicNavigationBarItemService.vb (3)
135Dim propertySymbol = TryCast(member, IPropertySymbol) 283Dim p = DirectCast(symbol, IPropertySymbol) 314eventContainer As IPropertySymbol,
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (6)
28[property] As IPropertySymbol, 49[property] As IPropertySymbol, 81[property] As IPropertySymbol, 114[property] As IPropertySymbol, 143[property] As IPropertySymbol, 170[property] As IPropertySymbol,
SignatureHelp\AbstractOrdinaryMethodSignatureHelpProvider.vb (2)
64ElseIf TypeOf symbol Is IPropertySymbol Then 65Dim [property] = DirectCast(symbol, IPropertySymbol)
SignatureHelp\AttributeSignatureHelpProvider.vb (1)
148DirectCast(namedParameter, IPropertySymbol).Type)
SignatureHelp\InvocationExpressionSignatureHelpProvider.ElementAccess.vb (5)
20defaultProperties As IList(Of IPropertySymbol), 36Private Shared Function ConvertIndexer(indexer As IPropertySymbol, 53Private Shared Function GetIndexerPreambleParts(symbol As IPropertySymbol, semanticModel As SemanticModel, position As Integer) As IList(Of SymbolDisplayPart) 60Private Shared Function GetIndexerPostambleParts(symbol As IPropertySymbol, 66Dim [property] = DirectCast(symbol, IPropertySymbol)
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (2)
107SpecializedCollections.EmptyList(Of IPropertySymbol), 109OfType(Of IPropertySymbol).
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (1)
60Protected Overrides Function CanConvert(prop As IPropertySymbol) As Boolean
UseAutoProperty\VisualBasicUseAutoPropertyCodeFixProvider.vb (1)
51propertySymbol As IPropertySymbol,
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (1)
EditAndContinue\TopLevelEditingTests.vb (1)
11035SemanticEdit(SemanticEditKind.Update, Function(c) CType(c.GetMember(Of NamedTypeSymbol)("C").GetMembers("P").First(), IPropertySymbol).GetMethod),
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (13)
Compilation\CompilationAPITests.vb (10)
1591Assert.Equal(2, type.GetMembers().OfType(Of IPropertySymbol).Count()) 1593Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1613Assert.Equal(2, type.GetMembers().OfType(Of IPropertySymbol).Count()) 1638Assert.Equal(1, type.GetMembers().OfType(Of IPropertySymbol).Count()) 1640Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1653Assert.Equal(1, type.GetMembers().OfType(Of IPropertySymbol).Count()) 1655Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1667Assert.Equal(2, type.GetMembers().OfType(Of IPropertySymbol).Count()) 1669Assert.All(type.GetMembers().OfType(Of IPropertySymbol)().Select(Function(p) p.Locations.FirstOrDefault()), 1730Return type.GetMembers().OfType(Of IPropertySymbol)().SelectAsArray(Function(p) p.NullableAnnotation)
Compilation\SemanticModelAPITests.vb (2)
4701Dim symbol = DirectCast(semanticModel.GetSymbolInfo(node).Symbol, IPropertySymbol) 4836Dim symbol = DirectCast(semanticModel.GetSymbolInfo(node).Symbol, IPropertySymbol)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
1088Dim propertySymbol As IPropertySymbol
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
SymbolDisplay\SymbolDisplayTests.vb (1)
5359Dim indexer = type.GetMembers().Where(Function(m) m.Kind = SymbolKind.Property AndAlso DirectCast(m, IPropertySymbol).IsIndexer).Single()
Microsoft.CodeAnalysis.VisualBasic.Workspaces (26)
FindSymbols\VisualBasicReferenceFinder.vb (3)
27Return DetermineCascadedSymbolsAsync(DirectCast(symbol, IPropertySymbol), project, cancellationToken) 36[property] As IPropertySymbol, 64From childProperty In type.GetMembers().OfType(Of IPropertySymbol)
Rename\VisualBasicRenameRewriterLanguageService.vb (4)
763DeclarationConflictHelpers.GetMembersWithConflictingSignatures(DirectCast(renamedSymbol, IPropertySymbol), trimOptionalParameters:=True) _ 919If TypeOf renamedSymbol Is IPropertySymbol Then 920If DirectCast(renamedSymbol, IPropertySymbol).IsOverloads Then 958Dim [property] = DirectCast(symbol, IPropertySymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (3)
304ElseIf TypeOf symbol Is IPropertySymbol Then 305Dim prop = DirectCast(symbol, IPropertySymbol) 513Not symbolInfo.GetBestOrAllSymbols().OfType(Of IPropertySymbol)().Any()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (10)
21[property] As IPropertySymbol, 33[property] As IPropertySymbol, 46Public Function GeneratePropertyDeclaration([property] As IPropertySymbol, 61Private Function GeneratePropertyDeclarationWorker([property] As IPropertySymbol, 100Private Function GeneratePropertyParameterList([property] As IPropertySymbol, options As CodeGenerationContextInfo) As ParameterListSyntax 108Private Function GenerateAccessorList([property] As IPropertySymbol, 119Private Function GenerateAccessor([property] As IPropertySymbol, 156Private Function GenerateAccessorModifiers([property] As IPropertySymbol, 174[property] As IPropertySymbol, 236Private Function GenerateAsClause([property] As IPropertySymbol, options As CodeGenerationContextInfo) As AsClauseSyntax
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
120[property] As IPropertySymbol, 566Public Overrides Function CreatePropertyDeclaration([property] As IPropertySymbol,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\SymbolExtensions.vb (1)
28Dim type = DirectCast(symbol, IPropertySymbol).Type
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (2)
374Dim properties = symbols.OfType(Of IPropertySymbol)() 770TryCast(memberSymbol, IPropertySymbol)?.Type)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\SymbolExtensions.vb (1)
16Dim propertySymbol = DirectCast(symbol, IPropertySymbol)
Microsoft.CodeAnalysis.Workspaces (160)
Editing\DeclarationModifiers.cs (3)
69IPropertySymbol or 74var property = symbol as IPropertySymbol;
Editing\SyntaxGenerator.cs (4)
365IPropertySymbol property, 448IPropertySymbol indexer, 726var property = (IPropertySymbol)symbol;
FindSymbols\FindReferences\Finders\AbstractMemberScopedReferenceFinder.cs (1)
79if (current is IPropertySymbol)
FindSymbols\FindReferences\Finders\AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs (1)
16FindReferencesDocumentState state, IPropertySymbol property, SyntaxNode node, CancellationToken cancellationToken)
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (2)
190if (containingMethod.AssociatedSymbol is IPropertySymbol property) 193else if (containingSymbol is IPropertySymbol containingProperty)
FindSymbols\FindReferences\Finders\PropertyAccessorSymbolReferenceFinder.cs (2)
47if (symbol.AssociatedSymbol is IPropertySymbol property && 74if (symbol.AssociatedSymbol is not IPropertySymbol property ||
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (16)
19internal sealed class PropertySymbolReferenceFinder : AbstractMethodOrPropertyOrEventSymbolReferenceFinder<IPropertySymbol> 27protected override bool CanFind(IPropertySymbol symbol) 31IPropertySymbol symbol, 46private static void CascadeToOtherPartOfPartial(IPropertySymbol symbol, ArrayBuilder<ISymbol> result) 52private static void CascadeToBackingFields(IPropertySymbol symbol, ArrayBuilder<ISymbol> result) 64private static void CascadeToAccessors(IPropertySymbol symbol, ArrayBuilder<ISymbol> result) 70private static void CascadeToPrimaryConstructorParameters(IPropertySymbol property, ArrayBuilder<ISymbol> result, CancellationToken cancellationToken) 108IPropertySymbol symbol, 131private static bool IsForEachProperty(IPropertySymbol symbol) 135IPropertySymbol symbol, 189IPropertySymbol symbol, 233IPropertySymbol symbol, 261IPropertySymbol symbol, FindReferencesDocumentState state, SyntaxNode node, CancellationToken cancellationToken) 270IPropertySymbol symbol, SyntaxNode node, FindReferencesDocumentState state, CancellationToken cancellationToken) 289IPropertySymbol symbol, SyntaxNode node, FindReferencesDocumentState state, CancellationToken cancellationToken) 306IPropertySymbol symbol, SyntaxNode node, FindReferencesDocumentState state, CancellationToken cancellationToken)
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (1)
370=> symbol is IMethodSymbol or IPropertySymbol or IEventSymbol;
FindSymbols\SymbolFinder_Hierarchy.cs (1)
111if (symbol is IMethodSymbol or IPropertySymbol or IEventSymbol)
ReassignedVariable\AbstractReassignedVariableService.cs (4)
185methodOrProperty = method.AssociatedSymbol as IPropertySymbol; 187if (methodOrProperty is not IMethodSymbol and not IPropertySymbol) 363if (localOrParameter is IParameterSymbol { ContainingSymbol: IPropertySymbol property } parameter) 386if (localOrParameter is IParameterSymbol { ContainingSymbol: IPropertySymbol property } parameter)
Rename\ConflictEngine\DeclarationConflictHelpers.cs (3)
26public static ImmutableArray<Location> GetMembersWithConflictingSignatures(IPropertySymbol renamedProperty, bool trimOptionalParameters) 30.OfType<IPropertySymbol>() 34property => GetAllSignatures(((IPropertySymbol)property).Parameters, trimOptionalParameters));
Rename\IRenameRewriterLanguageService.cs (2)
141var prop = (IPropertySymbol)symbol;
Rename\RenameUtilities.cs (3)
341if (containingMethod.AssociatedSymbol is IPropertySymbol) 343var associatedPropertyOrEvent = (IPropertySymbol)containingMethod.AssociatedSymbol;
Shared\Extensions\ITypeSymbolExtensions.cs (1)
132IPropertySymbol propertySymbol => typeSymbol.FindImplementations(propertySymbol, services),
Shared\Extensions\SyntaxGeneratorExtensions.cs (4)
43public static async Task<IPropertySymbol> OverridePropertyAsync( 45IPropertySymbol overriddenProperty, 179private static SyntaxNode WrapWithRefIfNecessary(SyntaxGenerator codeFactory, IPropertySymbol overriddenProperty, SyntaxNode body) 213else if (symbol is IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (13)
91return IsInterfacePropertyImplemented(classOrStructType, (IPropertySymbol)member); 103return IsAbstractPropertyImplemented(classOrStructType, (IPropertySymbol)member); 114private static bool IsInterfacePropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 128private static bool IsAbstractPropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol) 171IPropertySymbol property => property.ExplicitInterfaceImplementations.Length > 0, 214var property = (IPropertySymbol)member; 314var property = (IPropertySymbol)member; 413case IPropertySymbol property: 496var propertySymbol = (IPropertySymbol)symbol; 638IPropertySymbol { IsWithEvents: false } => true,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamespaceOrTypeSymbolExtensions.cs (2)
25public static IEnumerable<IPropertySymbol> GetIndexers(this INamespaceOrTypeSymbol? symbol) 29: symbol.GetMembers(WellKnownMemberNames.Indexer).OfType<IPropertySymbol>().Where(p => p.IsIndexer);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IParameterSymbolExtensions.cs (2)
23public static IPropertySymbol? GetAssociatedSynthesizedRecordProperty(this IParameterSymbol parameter, CancellationToken cancellationToken) 44if (member is IPropertySymbol { DeclaringSyntaxReferences.Length: > 0 } property &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IPropertySymbolExtensions.cs (1)
11public static IFieldSymbol? GetBackingFieldIfAny(this IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (14)
79IPropertySymbol property => property.OverriddenProperty, 89IPropertySymbol property => ImmutableArray<ISymbol>.CastUp(property.ExplicitInterfaceImplementations), 256=> symbol is IPropertySymbol && symbol.ContainingType.IsNormalAnonymousType(); 262=> symbol is IPropertySymbol { IsIndexer: true }; 268IPropertySymbol propertySymbol => !propertySymbol.IsReadOnly, 273=> symbol is IFieldSymbol { IsRequired: true } or IPropertySymbol { IsRequired: true }; 279IPropertySymbol propertySymbol => propertySymbol.Type, 362IPropertySymbol nt => nt.Parameters, 496public static IEnumerable<IPropertySymbol> GetValidAnonymousTypeProperties(this ISymbol symbol) 499return ((INamedTypeSymbol)symbol).GetMembers().OfType<IPropertySymbol>().Where(p => p.CanBeReferencedByName); 566IPropertySymbol propertySymbol => propertySymbol.Type, 620if (!returnType.GetMembers().OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.IsCompleted && p.Type.SpecialType == SpecialType.System_Boolean && p.GetMethod != null)) 659if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null)) 699if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.RequiresUnsafeModifierVisitor.cs (1)
84public override bool VisitProperty(IPropertySymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyleRules.cs (1)
52if (symbol is IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ForEachSymbols.cs (2)
13public readonly IPropertySymbol CurrentProperty; 19IPropertySymbol currentProperty,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (2)
22var properties = symbol.GetMembers().OfType<IPropertySymbol>().ToImmutableArray(); 39var contextualProperties = contextualSymbol?.GetMembers().OfType<IPropertySymbol>().ToImmutableArray() ?? [];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
58/// <item>Two <see cref="IPropertySymbol"/>s are the "same" if they have
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (1)
49case IPropertySymbol property:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (9)
11private sealed class PropertySymbolKey : AbstractSymbolKey<IPropertySymbol> 15public sealed override void Create(IPropertySymbol symbol, SymbolKeyWriter visitor) 26SymbolKeyReader reader, IPropertySymbol? contextualSymbol, out string? failureReason) 36using var properties = GetMembersOfNamedType<IPropertySymbol>(containingTypeResolution, metadataName: null); 37using var result = PooledArrayBuilder<IPropertySymbol>.GetInstance(); 47IPropertySymbol? property = null; 71_ = reader.ReadSymbolKeyArray<IPropertySymbol, ITypeSymbol>( 91private static IPropertySymbol? Resolve( 94IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (1)
461public override void VisitProperty(IPropertySymbol propertySymbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (10)
42SymbolKind.Property => HaveSameSignature((IPropertySymbol)symbol1, (IPropertySymbol)symbol2, caseSensitive), 51public bool HaveSameSignature(IPropertySymbol property1, IPropertySymbol property2, bool caseSensitive) 156var property1 = (IPropertySymbol)symbol1; 157var property2 = (IPropertySymbol)symbol2; 173private static bool HaveSameAccessors(IPropertySymbol property1, IPropertySymbol property2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.cs (2)
235private static bool IsPartialMethodDefinitionPart(IPropertySymbol symbol) 238private static bool IsPartialMethodImplementationPart(IPropertySymbol symbol)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (6)
130SymbolKind.Property => PropertiesAreEquivalent((IPropertySymbol)x, (IPropertySymbol)y, equivalentTypesWithDifferingAssemblies), 532var p1 = xMembersEnumerator.Current; 533var p2 = yMembersEnumerator.Current; 584private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (2)
71SymbolKind.Property => CombineHashCodes((IPropertySymbol)x, currentHash), 239private int CombineHashCodes(IPropertySymbol x, int currentHash)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (7)
57public TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode 86public SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken) 127protected abstract TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 150public abstract SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken); 348IPropertySymbol property => CreatePropertyDeclaration(property, codeGenerationDestination, info, cancellationToken), 366IPropertySymbol property => AddProperty(currentDestination, property, info, availableIndices, cancellationToken), 411public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (7)
47internal static IPropertySymbol CreatePropertySymbol( 54ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, 82public static IPropertySymbol CreatePropertySymbol( 84ITypeSymbol type, RefKind refKind, ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, string name, 544internal static IPropertySymbol CreatePropertySymbol( 545IPropertySymbol property, 550ImmutableArray<IPropertySymbol> explicitInterfaceImplementations = default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (1)
51public static Task<Document> AddPropertyDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (3)
39SyntaxNode CreatePropertyDeclaration(IPropertySymbol property, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken); 69TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNode destination, IPropertySymbol property, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode; 149Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertyInfo.cs (6)
13private static readonly ConditionalWeakTable<IPropertySymbol, CodeGenerationPropertyInfo> s_propertyToInfoMap = new(); 30IPropertySymbol property, 39private static CodeGenerationPropertyInfo GetInfo(IPropertySymbol property) 48public static SyntaxNode GetInitializer(IPropertySymbol property) 51public static bool GetIsNew(IPropertySymbol property) 54public static bool GetIsUnsafe(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationPropertySymbol.cs (7)
24ImmutableArray<IPropertySymbol> explicitInterfaceImplementations, 29IMethodSymbol setMethod) : CodeGenerationSymbol(containingType?.ContainingAssembly, containingType, attributes, declaredAccessibility, modifiers, name), IPropertySymbol 36public ImmutableArray<IPropertySymbol> ExplicitInterfaceImplementations { get; } = explicitInterfaceImplementations.NullToEmpty(); 73public new IPropertySymbol OriginalDefinition => this; 81public IPropertySymbol OverriddenProperty => null; 89public IPropertySymbol PartialImplementationPart => null; 91public IPropertySymbol PartialDefinitionPart => null;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (6)
15public static IPropertySymbol RenameParameters(this IPropertySymbol property, ImmutableArray<string> parameterNames) 40public static IPropertySymbol RemoveInaccessibleAttributesAndAttributesOfTypes( 41this IPropertySymbol property, ISymbol accessibleWithin, params INamedTypeSymbol[] attributesToRemove) 74public static bool IsWritableInConstructor(this IPropertySymbol property) 77private static bool ContainsBackingField(IPropertySymbol property)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (4)
91IPropertySymbol property => property.Type, 161else if (throughMember is IPropertySymbol { IsStatic: false, ExplicitInterfaceImplementations: [var explicitlyImplementedProperty, ..] }) 193IPropertySymbol property, ISymbol? throughMember, bool preferAutoProperties) 217IPropertySymbol property, ISymbol? throughMember, bool preferAutoProperties)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
445var property = propertyOperation.Property;
Microsoft.CodeAnalysis.Workspaces.UnitTests (11)
SymbolKeyTests.cs (8)
1091var symbol = (IPropertySymbol)GetAllSymbols( 1126var symbol = (IPropertySymbol)GetAllSymbols( 1173var symbol = (IPropertySymbol)GetAllSymbols( 1220var symbol = (IPropertySymbol)GetAllSymbols(
UtilityTest\DocumentationCommentIdTests.cs (3)
247CheckDeclarationIdExact<IPropertySymbol>("P:Acme.Widget.Width", compilation, p => p.Name == "Width"); 248CheckDeclarationIdExact<IPropertySymbol>("P:Acme.Widget.Item(System.Int32)", compilation, p => p.Parameters.Length == 1); 249CheckDeclarationIdExact<IPropertySymbol>("P:Acme.Widget.Item(System.String,System.Int32)", compilation, p => p.Parameters.Length == 2);
Microsoft.Extensions.Options.SourceGeneration (3)
Parser.cs (1)
321case IPropertySymbol prop:
ParserUtilities.cs (2)
81if (type.GetMembers(propertyName).OfType<IPropertySymbol>().Any(property => 95if (interfaceType.GetMembers(propertyName).OfType<IPropertySymbol>().Any(property =>
Microsoft.Gen.ComplianceReports (2)
Parser.cs (2)
142foreach (var property in typeSymbol.GetMembers().OfType<IPropertySymbol>())
Microsoft.Gen.ContextualOptions (2)
Parser.cs (2)
78.OfType<IPropertySymbol>() 90static bool GetterIsPublic(IPropertySymbol prop) =>
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (1)
653IPropertySymbol ps => ps.Type,
Parsing\Parser.LogProperties.cs (3)
73static string GetPropertyIdentifier(IPropertySymbol property, CancellationToken token) 123foreach (var property in members.Where(m => m.Kind == SymbolKind.Property).Cast<IPropertySymbol>())
Parsing\Parser.Records.cs (3)
30IPropertySymbol? Property); 66IPropertySymbol property => new(property.Name, property.Type, property), 96var property = memberInfo.Property;
Parsing\Parser.TagProvider.cs (1)
49IPropertySymbol propSymbol,
Microsoft.Gen.Metrics (2)
Parser.cs (2)
698var propertySymbol = member as IPropertySymbol;
Microsoft.Gen.MetricsReports (2)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (2)
698var propertySymbol = member as IPropertySymbol;
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
985if (marshallerType.GetMembers(ShapeMemberNames.BufferSize).OfType<IPropertySymbol>().FirstOrDefault(prop => prop is { ReturnsByRef: false, ReturnsByRefReadonly: false, GetMethod: not null }) is null)
Microsoft.ML.InternalCodeAnalyzer (2)
InstanceInitializerAnalyzer.cs (2)
65var symbol = (IPropertySymbol)context.Symbol;
Microsoft.VisualStudio.LanguageServices (11)
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (2)
219BuildPropertyDeclaration((IPropertySymbol)symbol, options); 242protected abstract void BuildPropertyDeclaration(IPropertySymbol propertySymbol, _VSOBJDESCOPTIONS options);
Progression\GraphBuilder.cs (4)
284node = await GetOrCreateNodeForPropertyAsync(graph, (IPropertySymbol)symbol, solution, cancellationToken).ConfigureAwait(false); 408var propertySymbol = (IPropertySymbol)symbol; 654private static async Task<GraphNode> GetOrCreateNodeForPropertyAsync(Graph graph, IPropertySymbol property, Solution solution, CancellationToken cancellationToken)
Progression\GraphNodeIdCreation.cs (2)
471var property = (IPropertySymbol)method.AssociatedSymbol;
Progression\GraphQueries\ImplementedByGraphQuery.cs (1)
30IPropertySymbol or
Progression\GraphQueries\ImplementsGraphQuery.cs (1)
36IPropertySymbol or
Progression\GraphQueries\OverridesGraphQuery.cs (1)
28IPropertySymbol or
Microsoft.VisualStudio.LanguageServices.CSharp (7)
CodeModel\CSharpCodeModelService_Prototype.cs (5)
35return GetPropertyPrototype((IPropertySymbol)symbol, flags); 58return GetPropertyPrototype(propertyDeclaration, (IPropertySymbol)symbol, flags); 181private string GetPropertyPrototype(IPropertySymbol symbol, PrototypeFlags flags) 202private string GetPropertyPrototype(BasePropertyDeclarationSyntax node, IPropertySymbol symbol, PrototypeFlags flags) 437private void AppendPropertyPrototype(StringBuilder builder, IPropertySymbol symbol, PrototypeFlags flags, string baseName)
ObjectBrowser\DescriptionBuilder.cs (1)
487protected override void BuildPropertyDeclaration(IPropertySymbol propertySymbol, _VSOBJDESCOPTIONS options)
Progression\CSharpProgressionLanguageService.cs (1)
120case IPropertySymbol p: return p.Type;
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
GlyphExtensionsTests.cs (1)
251var propertyMock = symbolMock.As<IPropertySymbol>();
Microsoft.VisualStudio.LanguageServices.VisualBasic (6)
CodeModel\MethodXML\MethodXmlBuilder.vb (1)
325Dim propertySymbol = TryCast(symbol, IPropertySymbol)
CodeModel\VisualBasicCodeModelService.vb (3)
1399Dim propertySymbol = TryCast(fieldSymbol.AssociatedSymbol, IPropertySymbol) 1452If TryCast(symbol, IPropertySymbol)?.IsWithEvents Then 4193Not TypeOf symbol Is IPropertySymbol Then
CodeModel\VisualBasicCodeModelService_Prototype.vb (1)
38Dim propertySymbol = DirectCast(symbol, IPropertySymbol)
ObjectBrowser\DescriptionBuilder.vb (1)
244Protected Overrides Sub BuildPropertyDeclaration(propertySymbol As IPropertySymbol, options As _VSOBJDESCOPTIONS)
Mvc.Analyzers.Test (6)
CodeAnalysisExtensionsTest.cs (6)
476var testProperty = (IPropertySymbol)testClass.GetMembers("SomeProperty").First(); 657var property = (IPropertySymbol)testClass.GetMembers("SomeProperty").First(); 691var property = (IPropertySymbol)testClass.GetMembers("SomeProperty").First();
System.Private.CoreLib.Generators (1)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (1)
509if (symbol is IPropertySymbol propertySymbol)
System.Text.Json.SourceGeneration (12)
Helpers\RoslynExtensions.cs (5)
215Debug.Assert(member is IFieldSymbol or IPropertySymbol); 216return member is IFieldSymbol fs ? fs.Type : ((IPropertySymbol)member).Type; 221Debug.Assert(member is IFieldSymbol or IPropertySymbol); 222Debug.Assert(otherMember is IFieldSymbol or IPropertySymbol); 301public static void ResolveNullabilityAnnotations(this IPropertySymbol property, out bool isGetterNonNullable, out bool isSetterNonNullable)
JsonSourceGenerator.Parser.cs (7)
928foreach (IPropertySymbol propertyInfo in members.OfType<IPropertySymbol>()) 1017bool PropertyIsOverriddenAndIgnored(IPropertySymbol property, Dictionary<string, ISymbol>? ignoredMembers) 1122Debug.Assert(memberInfo is IFieldSymbol or IPropertySymbol); 1203IsProperty = memberInfo is IPropertySymbol, 1242Debug.Assert(memberInfo is IFieldSymbol or IPropertySymbol); 1357case IPropertySymbol propertyInfo:
System.Text.RegularExpressions.Generator (5)
RegexGenerator.Parser.cs (5)
56ISymbol? regexMemberSymbol = context.TargetSymbol is IMethodSymbol or IPropertySymbol ? context.TargetSymbol : null; 128Debug.Assert(regexMemberSymbol is IPropertySymbol); 129IPropertySymbol regexPropertySymbol = (IPropertySymbol)regexMemberSymbol; 216IsProperty: regexMemberSymbol is IPropertySymbol,
System.Windows.Forms.Analyzers.CSharp (2)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (2)
28var propertySymbol = (IPropertySymbol)context.Symbol;
System.Windows.Forms.Analyzers.VisualBasic (2)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (2)
30Dim propertySymbol As IPropertySymbol = TryCast(context.Symbol, IPropertySymbol)