2 implementations of SetMethod
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\PropertySymbol.cs (1)
56IMethodSymbol IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
568Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
190 references to SetMethod
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\Members\PropertySpec.cs (1)
13IMethodSymbol? setMethod = property.SetMethod;
ILLink.RoslynAnalyzer (15)
DataFlow\DynamicallyAccessedMembersBinder.cs (10)
251 (property.SetMethod == null || property.SetMethod.DeclaredAccessibility == Accessibility.Private)) 259 if ((property.SetMethod != null) && !property.SetMethod.IsStatic) continue; 264 if ((property.SetMethod != null) && property.SetMethod.IsStatic) continue; 269 && (property.SetMethod == null || (property.SetMethod.DeclaredAccessibility != Accessibility.Public))) 275 if ((property.SetMethod != null) && (property.SetMethod.DeclaredAccessibility == Accessibility.Public)) continue;
IPropertySymbolExtensions.cs (1)
25 while ((setMethod = declaringProperty.SetMethod) == null) {
RequiresAnalyzerBase.cs (1)
316 if (!propertySymbol.IsStatic || propertySymbol.Type.SpecialType != SpecialType.System_Boolean || propertySymbol.SetMethod != null)
TrimAnalysis\FeatureCheckReturnValuePattern.cs (1)
40 if (!OwningSymbol.IsStatic || OwningSymbol.Type.SpecialType != SpecialType.System_Boolean || OwningSymbol.SetMethod != null) {
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
168 if (propertySymbol.SetMethod is not null) 169 GetReflectionAccessDiagnosticsForMethod (location, propertySymbol.SetMethod);
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParameterAnalyzer.cs (1)
89else if (property.SetMethod?.DeclaredAccessibility != Accessibility.Public)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParameterAnalyzer.cs (1)
83else if (property.SetMethod?.DeclaredAccessibility != Accessibility.Public)
Microsoft.CodeAnalysis.CodeStyle (18)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
517member is IPropertySymbol { GetMethod: not null, SetMethod: not null } property2 &&
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
452if (property.SetMethod != null) 455var setterFields = GetSetterFields(semanticModel, property.SetMethod, fieldNames, cancellationToken); 570result.Property.SetMethod is null && 583if (result.Property.SetMethod is { IsInitOnly: true } && 601if (result.Property.SetMethod != null &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (7)
118return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 139if (propertySymbol.SetMethod != null) 141if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 216return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 316return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 501propertySymbol.SetMethod != null && 503propertySymbol.SetMethod.IsAccessibleWithin(within))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (4)
179BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 189BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
Microsoft.CodeAnalysis.CodeStyle.Fixes (13)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
131if (!IsSymbolAccessible(((IPropertySymbol)symbol).SetMethod, document))
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
46if (symbol is IPropertySymbol { SetMethod: { } setMethod } &&
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
229IsWrittenTo = propertySymbol.SetMethod != null;
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (3)
221var setMethod = ShouldGenerateAccessor(property.SetMethod) 223property.SetMethod, 225accessibility: property.SetMethod.ComputeResultantAccessibility(ClassType),
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
142if (IsLessAccessibleThan(propertySymbol.SetMethod, second))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (3)
99if (property.SetMethod == null) 110var setMethod = property.SetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes( 118explicitInterfaceImplementations: useExplicitInterfaceSymbol ? [property.SetMethod] : default,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
Microsoft.CodeAnalysis.CSharp (3)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (3)
104var setMethod = property.SetMethod; 178var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; 179AddAccessor(symbol, symbol.SetMethod, keywordForSetAccessor);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (8)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (1)
160var setAccessor = propertySymbol.SetMethod;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
64var setMethod = propertySymbol.SetMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
212if (property.SetMethod != null) 214var setMethod = property.SetMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (4)
264var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 268GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info, cancellationToken), 338var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 379var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (3)
FlowAnalysis\FlowTests.cs (1)
5843var parameter = property.SetMethod.Parameters[0].GetSymbol<SourceComplexParameterSymbolBase>();
Semantics\RecordTests.cs (2)
903Assert.Equal("void modreq(System.Runtime.CompilerServices.IsExternalInit) C.X.init", x.SetMethod.ToTestDisplayString()); 904Assert.True(x.SetMethod!.IsInitOnly);
Microsoft.CodeAnalysis.CSharp.Features (15)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (10)
1120AddMemberUpdate(ref result, oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, matchingNewContainingMemberOrType); 1136result.Add((oldSynthesizedAutoProperty?.SetMethod, newSynthesizedAutoProperty?.SetMethod, editKind)); 1222if (oldPropertySymbol.SetMethod != null || newPropertySymbol.SetMethod != null) 1224if (DiffersInReadOnlyModifier(oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod) || 1227result.Add((oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, editKind));
InitializeParameter\InitializeParameterHelpers.cs (2)
205if (property.SetMethod != null) 206accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
92var setMethod = property.SetMethod;
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\PositionalParameterInfo.cs (1)
160var setAccessor = propertySymbol.SetMethod;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
64var setMethod = propertySymbol.SetMethod;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (10)
Semantics\InitOnlyMemberTests.cs (1)
52Assert.True(publicProperty.SetMethod.IsInitOnly);
Semantics\ReadOnlyStructsTests.cs (5)
1197Assert.False(getProperty(s1, "P1").SetMethod.IsReadOnly); 1203Assert.True(getProperty(s1, "P4").SetMethod.IsReadOnly); 1206Assert.False(getProperty(s1, "P5").SetMethod.IsReadOnly); 1219Assert.True(getProperty(s2, "P3").SetMethod.IsReadOnly); 1222Assert.False(getProperty(s2, "P4").SetMethod.IsReadOnly);
Semantics\RecordStructTests.cs (4)
1766Assert.Equal("void C.X.set", x.SetMethod.ToTestDisplayString()); 1767Assert.False(x.SetMethod!.IsInitOnly); 1813Assert.Equal("void modreq(System.Runtime.CompilerServices.IsExternalInit) C.X.init", x.SetMethod.ToTestDisplayString()); 1814Assert.True(x.SetMethod!.IsInitOnly);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (2)
2887Assert.Same(explicitPropertySymbol.SetMethod, explicitPropertySetterSymbol); 3157Assert.Equal(prop.SetMethod, dsym);
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (2)
212if (property.SetMethod != null) 214var setMethod = property.SetMethod;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (4)
264var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 268GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info, cancellationToken), 338var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 379var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Microsoft.CodeAnalysis.Features (34)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
353var setMethod = prop.SetMethod != null ? CreateAccessorSymbol(prop, MethodKind.PropertySet) : null;
EditAndContinue\Utilities\Extensions.cs (1)
142=> property is { GetMethod.IsImplicitlyDeclared: true, SetMethod.IsImplicitlyDeclared: true };
ExtractInterface\AbstractExtractInterfaceService.cs (5)
423setMethod: property.SetMethod == null ? null : (property.SetMethod.DeclaredAccessibility == Accessibility.Public ? property.SetMethod : null), 454(prop.SetMethod != null && prop.SetMethod.DeclaredAccessibility == Accessibility.Public));
GenerateType\AbstractGenerateTypeService.Editor.cs (2)
631property.SetMethod != null && 632IsSymbolAccessible(property.SetMethod) &&
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (2)
755if (property.SetMethod != null) 756accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
PullMemberUp\MembersPuller.cs (3)
165setMethod: MakePublicAccessor(propertySymbol.SetMethod)); 174setMethod: FilterOutNonPublicAccessor(propertySymbol.SetMethod)); 455return CodeGenerationSymbolFactory.CreatePropertySymbol(propertySymbol, modifiers: modifier, getMethod: propertySymbol.GetMethod, setMethod: propertySymbol.SetMethod);
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (1)
427=> _propertyBackingField != null && _property.SetMethod == null;
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (2)
61(propertySymbol.SetMethod == null ? 0 : 1); 152return property.SetMethod != null &&
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
517member is IPropertySymbol { GetMethod: not null, SetMethod: not null } property2 &&
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (5)
452if (property.SetMethod != null) 455var setterFields = GetSetterFields(semanticModel, property.SetMethod, fieldNames, cancellationToken); 570result.Property.SetMethod is null && 583if (result.Property.SetMethod is { IsInitOnly: true } && 601if (result.Property.SetMethod != null &&
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
131if (!IsSymbolAccessible(((IPropertySymbol)symbol).SetMethod, document))
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
46if (symbol is IPropertySymbol { SetMethod: { } setMethod } &&
src\Analyzers\Core\CodeFixes\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
229IsWrittenTo = propertySymbol.SetMethod != null;
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (3)
221var setMethod = ShouldGenerateAccessor(property.SetMethod) 223property.SetMethod, 225accessibility: property.SetMethod.ComputeResultantAccessibility(ClassType),
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
142if (IsLessAccessibleThan(propertySymbol.SetMethod, second))
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementInterfaceGenerator_Property.cs (3)
99if (property.SetMethod == null) 110var setMethod = property.SetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes( 118explicitInterfaceImplementations: useExplicitInterfaceSymbol ? [property.SetMethod] : default,
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
119(property.SetMethod != null && !isTrivialSetAccessor))
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
568Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
70If prop.SetMethod IsNot Nothing AndAlso 71prop.SetMethod.DeclaredAccessibility <> prop.DeclaredAccessibility Then
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (4)
79Dim setMethod = [property].SetMethod 113GenerateAccessor([property], [property].SetMethod, isGetter:=False, destination:=destination, options:=options) 217[property].SetMethod IsNot Nothing Then 221If [property].SetMethod Is Nothing AndAlso
Microsoft.CodeAnalysis.VisualBasic.Features (9)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (6)
786AddMemberUpdate(result, oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, matchingNewContainingMemberOrType) 838If oldPropertySymbol.SetMethod IsNot Nothing OrElse newPropertySymbol.SetMethod IsNot Nothing Then 840result.Add((oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, editKind))
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (1)
69Dim setMethod = [property].SetMethod
src\Analyzers\VisualBasic\Analyzers\UseAutoProperty\VisualBasicUseAutoPropertyAnalyzer.vb (2)
70If prop.SetMethod IsNot Nothing AndAlso 71prop.SetMethod.DeclaredAccessibility <> prop.DeclaredAccessibility Then
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (1)
1107Assert.Equal(parameterSymbol.ContainingSymbol, propertySymbol.SetMethod)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\PropertyGenerator.vb (4)
79Dim setMethod = [property].SetMethod 113GenerateAccessor([property], [property].SetMethod, isGetter:=False, destination:=destination, options:=options) 217[property].SetMethod IsNot Nothing Then 221If [property].SetMethod Is Nothing AndAlso
Microsoft.CodeAnalysis.Workspaces (29)
Editing\SyntaxGenerator.cs (1)
371var setMethodSymbol = property.SetMethod;
FindSymbols\FindReferences\Finders\AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs (1)
37result.AddIfNotNull(property.SetMethod);
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (3)
198if (containingProperty.SetMethod != null && ordinal < containingProperty.SetMethod.Parameters.Length) 199results.Add(containingProperty.SetMethod.Parameters[ordinal]);
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
67result.AddIfNotNull(symbol.SetMethod);
ReassignedVariable\AbstractReassignedVariableService.cs (2)
366var setParameter = property.SetMethod?.Parameters[parameter.Ordinal]; 389var setParameter = property.SetMethod?.Parameters[parameter.Ordinal];
Shared\Extensions\SyntaxGeneratorExtensions.cs (6)
52var setAccessibility = overriddenProperty.SetMethod.ComputeResultantAccessibility(containingType); 89var setName = overriddenProperty.SetMethod?.Name; 107codeFactory.CreateArguments(overriddenProperty.SetMethod.GetParameters()))); 158if (overriddenProperty.SetMethod is { DeclaredAccessibility: not Accessibility.Private } && 159overriddenProperty.SetMethod.IsAccessibleWithin(containingType)) 162overriddenProperty.SetMethod,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (7)
118return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 139if (propertySymbol.SetMethod != null) 141if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 216return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 316return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 501propertySymbol.SetMethod != null && 503propertySymbol.SetMethod.IsAccessibleWithin(within))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SignatureComparer.cs (4)
179BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 189BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
Microsoft.VisualStudio.LanguageServices.CSharp (3)
ObjectBrowser\DescriptionBuilder.cs (3)
518if (propertySymbol.SetMethod != null) 520if (propertySymbol.SetMethod.DeclaredAccessibility != propertySymbol.DeclaredAccessibility) 522BuildAccessibility(propertySymbol.SetMethod);
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
ObjectBrowser\DescriptionBuilder.vb (2)
248If propertySymbol.SetMethod Is Nothing Then 251ElseIf propertySymbol.SetMethod IsNot Nothing Then
System.Text.Json.SourceGeneration (2)
Helpers\RoslynExtensions.cs (1)
312isSetterNonNullable = property.SetMethod != null && IsInputTypeNonNullable(property, property.Type);
JsonSourceGenerator.Parser.cs (1)
1379if (propertyInfo.SetMethod is { } setMethod)
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Parser.cs (1)
132regexPropertySymbol.SetMethod is not null ||
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
41if (propertySymbol.SetMethod is null
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
44If propertySymbol.SetMethod Is Nothing OrElse