5 implementations of SetMethod
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
CodeGenerationPropertySymbol.cs (1)
28public IMethodSymbol SetMethod { get; }
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\PropertySymbol.cs (1)
56IMethodSymbol IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
56public IMethodSymbol SetMethod => _symbol.SetMethod;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
568Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.Workspaces (1)
CodeGenerationPropertySymbol.cs (1)
28public IMethodSymbol SetMethod { get; }
186 references to SetMethod
Microsoft.CodeAnalysis.CodeStyle (11)
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
509if (property.GetMethod != null && property.SetMethod != null &&
AbstractUseAutoPropertyAnalyzer.cs (2)
236var setMethod = property.SetMethod; 305result.Property.SetMethod is null &&
INamedTypeSymbolExtensions.cs (7)
117return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 138if (propertySymbol.SetMethod != null) 140if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 223return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 323return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 481propertySymbol.SetMethod != null && 483propertySymbol.SetMethod.IsAccessibleWithin(within))
SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
Microsoft.CodeAnalysis.CSharp (3)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (3)
105var setMethod = property.SetMethod; 179var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; 180AddAccessor(symbol, symbol.SetMethod, keywordForSetAccessor);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (9)
CSharpCodeGenerationService.cs (2)
214if (property.SetMethod != null) 216var setMethod = property.SetMethod;
CSharpMakeMemberRequiredCodeFixProvider.cs (1)
64var setMethod = propertySymbol.SetMethod;
PositionalParameterInfo.cs (2)
57.Any(symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true }); 161var setAccessor = propertySymbol.SetMethod;
PropertyGenerator.cs (4)
260var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 264GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info), 332var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 375var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (29)
EditAndContinue\TopLevelEditingTests.cs (29)
2422SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), 2464SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), 2506SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), 3392SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3416SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3490SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3514SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3605SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3646SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), 3684SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").SetMethod) 6374SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P1").SetMethod, preserveLocalVariables: false), 6376SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P2").SetMethod, preserveLocalVariables: false), 6378SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Int32").SetMethod, preserveLocalVariables: false), 6380SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Byte").SetMethod, preserveLocalVariables: false), 6607SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) 14128SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 14144SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod, preserveLocalVariables: false), 14541new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }, 15013SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) 15037SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod) 15063SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 15065SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod), 15090SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), 15190SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P3").SetMethod, preserveLocalVariables: false) 15899new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) }, 16107SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) 16131SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) 16157SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod), 16268SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.Parameters.Single().Type.Name == "Byte").SetMethod, preserveLocalVariables: false)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
FlowAnalysis\FlowTests.cs (1)
5843var parameter = property.SetMethod.Parameters[0].GetSymbol<SourceComplexParameterSymbolBase>();
Microsoft.CodeAnalysis.CSharp.Features (10)
CSharpMakeMemberRequiredCodeFixProvider.cs (1)
64var setMethod = propertySymbol.SetMethod;
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (6)
1330if (oldPropertySymbol.SetMethod != null && newPropertySymbol.SetMethod != null && oldPropertySymbol.SetMethod.IsReadOnly != newPropertySymbol.SetMethod.IsReadOnly) 1332builder.Add((oldPropertySymbol.SetMethod, newPropertySymbol.SetMethod, editKind));
PositionalParameterInfo.cs (2)
57.Any(symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true }); 161var setAccessor = propertySymbol.SetMethod;
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
90var setMethod = property.SetMethod;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (30)
Semantics\InitOnlyMemberTests.cs (19)
50Assert.True(publicProperty.SetMethod.IsInitOnly); 414Assert.False(property.GetPublicSymbol().SetMethod.IsInitOnly); 418Assert.True(property2.GetPublicSymbol().SetMethod.IsInitOnly); 422Assert.True(property3.GetPublicSymbol().SetMethod.IsInitOnly); 613Assert.True(property.GetPublicSymbol().SetMethod.IsInitOnly); 644Assert.True(property.GetPublicSymbol().SetMethod.IsInitOnly); 903Assert.True(property.GetPublicSymbol().SetMethod.IsInitOnly); 1158Assert.False(property.GetPublicSymbol().SetMethod.IsInitOnly); 3815Assert.False(property0.GetPublicSymbol().SetMethod.IsInitOnly); 3903Assert.False(property0.GetPublicSymbol().SetMethod.IsInitOnly); 3992Assert.False(property0.GetPublicSymbol().SetMethod.IsInitOnly); 4057Assert.False(property.GetPublicSymbol().SetMethod.IsInitOnly); 4250Assert.False(i.SetMethod.IsReadOnly); 4289Assert.False(i.SetMethod.IsReadOnly); 4329Assert.False(i.SetMethod.IsReadOnly); 4371Assert.False(i.SetMethod.IsReadOnly); 4394Assert.False(i.SetMethod.IsReadOnly); 4425Assert.False(i1.SetMethod.IsReadOnly); 4427Assert.False(i2.SetMethod.IsReadOnly);
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);
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.Symbol.UnitTests (3)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (3)
361Assert.Equal(propertySymbol.SetMethod, setterSymbol); 2887Assert.Same(explicitPropertySymbol.SetMethod, explicitPropertySetterSymbol); 3157Assert.Equal(prop.SetMethod, dsym);
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
CSharpCodeGenerationService.cs (2)
214if (property.SetMethod != null) 216var setMethod = property.SetMethod;
PropertyGenerator.cs (4)
260var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 264GenerateAccessorDeclaration(property, property.SetMethod, setAccessorKind, destination, info), 332var hasNonReadOnlyAccessor = property.GetMethod?.IsReadOnly == false || property.SetMethod?.IsReadOnly == false; 375var hasAllReadOnlyAccessors = property.GetMethod?.IsReadOnly != false && property.SetMethod?.IsReadOnly != false;
Microsoft.CodeAnalysis.Features (34)
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
509if (property.GetMethod != null && property.SetMethod != null &&
AbstractUseAutoPropertyAnalyzer.cs (2)
236var setMethod = property.SetMethod; 305result.Property.SetMethod is null &&
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
293properties.WhereAsArray(p => p.SetMethod == null)); 355var setMethod = prop.SetMethod != null ? CreateAccessorSymbol(prop, MethodKind.PropertySet) : null;
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (3)
3491AddEdit(propertySymbol.SetMethod); 3505if (propertySymbol.SetMethod is not null) 3507processedSymbols.Add(propertySymbol.SetMethod);
ExtractInterface\AbstractExtractInterfaceService.cs (5)
424setMethod: property.SetMethod == null ? null : (property.SetMethod.DeclaredAccessibility == Accessibility.Public ? property.SetMethod : null), 455(prop.SetMethod != null && prop.SetMethod.DeclaredAccessibility == Accessibility.Public));
GenerateMember\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
132if (!IsSymbolAccessible(((IPropertySymbol)symbol).SetMethod, document))
GenerateMember\GenerateConstructor\GenerateConstructorHelpers.cs (1)
47if (symbol is IPropertySymbol { SetMethod: { } setMethod } property &&
GenerateMember\GenerateVariable\AbstractGenerateVariableService.State.cs (1)
229IsWrittenTo = propertySymbol.SetMethod != null;
GenerateType\AbstractGenerateTypeService.Editor.cs (2)
643property.SetMethod != null && 644IsSymbolAccessible(property.SetMethod) &&
ImplementAbstractClass\ImplementAbstractClassData.cs (3)
222var setMethod = ShouldGenerateAccessor(property.SetMethod) 224property.SetMethod, 226accessibility: property.SetMethod.ComputeResultantAccessibility(ClassType),
ImplementInterface\AbstractImplementInterfaceService.AccessibilityHelper.cs (1)
44if (IsLessAccessibleThan(propertySymbol.SetMethod, second))
ImplementInterface\AbstractImplementInterfaceService.CodeAction_Property.cs (3)
93if (property.SetMethod == null) 104var setMethod = property.SetMethod.RemoveInaccessibleAttributesAndAttributesOfTypes( 112explicitInterfaceImplementations: useExplicitInterfaceSymbol ? ImmutableArray.Create(property.SetMethod) : default,
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (2)
812if (property.SetMethod != null) 813accessors.AddIfNotNull(GetAccessorBody(property.SetMethod, cancellationToken));
MetadataAsSource\AbstractMetadataAsSourceService.WrappedPropertySymbol.cs (1)
56public IMethodSymbol SetMethod => _symbol.SetMethod;
PullMemberUp\MembersPuller.cs (3)
172setMethod: MakePublicAccessor(propertySymbol.SetMethod)); 181setMethod: FilterOutNonPublicAccessor(propertySymbol.SetMethod)); 468return 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); 153return property.SetMethod != null &&
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\PropertySymbol.vb (1)
568Private ReadOnly Property IPropertySymbol_SetMethod As IMethodSymbol Implements IPropertySymbol.SetMethod
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (2)
VisualBasicUseAutoPropertyAnalyzer.vb (2)
55If prop.SetMethod IsNot Nothing AndAlso 56prop.SetMethod.DeclaredAccessibility <> prop.DeclaredAccessibility Then
Microsoft.CodeAnalysis.VisualBasic.Features (3)
ReplacePropertyWithMethods\VisualBasicReplacePropertyWithMethods.vb (1)
70Dim setMethod = [property].SetMethod
VisualBasicUseAutoPropertyAnalyzer.vb (2)
55If prop.SetMethod IsNot Nothing AndAlso 56prop.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)
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 (30)
Editing\SyntaxGenerator.cs (1)
382var setMethodSymbol = property.SetMethod;
FindSymbols\FindReferences\Finders\AbstractMethodOrPropertyOrEventSymbolReferenceFinder.cs (1)
39result.AddIfNotNull(property.SetMethod);
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (3)
193if (containingProperty.SetMethod != null && ordinal < containingProperty.SetMethod.Parameters.Length) 194results.Add(containingProperty.SetMethod.Parameters[ordinal]);
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
54result.AddIfNotNull(symbol.SetMethod);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs\INamedTypeSymbolExtensions.cs (7)
117return IsAccessorImplemented(propertySymbol.GetMethod, classOrStructType) && IsAccessorImplemented(propertySymbol.SetMethod, classOrStructType); 138if (propertySymbol.SetMethod != null) 140if (classOrStructType.FindImplementationForAbstractMember(propertySymbol.SetMethod) == null) 223return IsNonPublicImplementableAccessor(property.GetMethod) || IsNonPublicImplementableAccessor(property.SetMethod); 323return IsInaccessibleImplementableAccessor(property.GetMethod, within) || IsInaccessibleImplementableAccessor(property.SetMethod, within); 481propertySymbol.SetMethod != null && 483propertySymbol.SetMethod.IsAccessibleWithin(within))
ReassignedVariable\AbstractReassignedVariableService.cs (2)
304var setParameter = property.SetMethod?.Parameters[parameter.Ordinal]; 327var setParameter = property.SetMethod?.Parameters[parameter.Ordinal];
Shared\Extensions\IPropertySymbolExtensions.cs (3)
36property.SetMethod, 66property.SetMethod, 75=> property.SetMethod != null || ContainsBackingField(property);
Shared\Extensions\SyntaxGeneratorExtensions.cs (7)
319var setAccessibility = overriddenProperty.SetMethod.ComputeResultantAccessibility(containingType); 356var setName = overriddenProperty.SetMethod?.Name; 374codeFactory.CreateArguments(overriddenProperty.SetMethod.GetParameters()))); 425if (overriddenProperty.SetMethod != null && 426overriddenProperty.SetMethod.IsAccessibleWithin(containingType) && 427overriddenProperty.SetMethod.DeclaredAccessibility != Accessibility.Private) 430overriddenProperty.SetMethod,
Shared\Utilities\SignatureComparer.cs (4)
179BadPropertyAccessor(property1.SetMethod, property2.SetMethod)) 189BadPropertyAccessor(property2.SetMethod, property1.SetMethod))
SymbolKey.AnonymousTypeSymbolKey.cs (1)
25var propertyIsReadOnly = properties.SelectAsArray(p => p.SetMethod == null);
Microsoft.VisualStudio.LanguageServices.CSharp (3)
ObjectBrowser\DescriptionBuilder.cs (3)
506if (propertySymbol.SetMethod != null) 508if (propertySymbol.SetMethod.DeclaredAccessibility != propertySymbol.DeclaredAccessibility) 510BuildAccessibility(propertySymbol.SetMethod);
Microsoft.VisualStudio.LanguageServices.Implementation (4)
CodeModel\ExternalElements\ExternalCodeProperty.cs (4)
72if (symbol.SetMethod == null) 77return ExternalCodeAccessorFunction.Create(this.State, this.ProjectId, symbol.SetMethod, this); 165return symbol.SetMethod != null 169else if (symbol.SetMethod != null)
Microsoft.VisualStudio.LanguageServices.VisualBasic (2)
ObjectBrowser\DescriptionBuilder.vb (2)
248If propertySymbol.SetMethod Is Nothing Then 251ElseIf propertySymbol.SetMethod IsNot Nothing Then