2 implementations of AddMethod
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\EventSymbol.cs (1)
40IMethodSymbol? IEventSymbol.AddMethod
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\EventSymbol.vb (1)
290Private ReadOnly Property IEventSymbol_AddMethod As IMethodSymbol Implements IEventSymbol.AddMethod
49 references to AddMethod
ILLink.RoslynAnalyzer (13)
DataFlow\DynamicallyAccessedMembersBinder.cs (10)
300 (@event.AddMethod == null || @event.AddMethod.DeclaredAccessibility == Accessibility.Private) && 308 if ((@event.AddMethod != null) && !@event.AddMethod.IsStatic) continue; 313 if ((@event.AddMethod != null) && @event.AddMethod.IsStatic) continue; 318 if ((@event.AddMethod == null || (@event.AddMethod.DeclaredAccessibility != Accessibility.Public)) 324 if ((@event.AddMethod != null) && @event.AddMethod.DeclaredAccessibility == Accessibility.Public) continue;
DataFlow\LocalDataFlowVisitor.cs (1)
435 IMethodSymbol? addMethod = eventReference.Event.AddMethod;
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
176 if (eventSymbol.AddMethod is not null) 177 GetReflectionAccessDiagnosticsForMethod (location, eventSymbol.AddMethod);
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
244addMethod: GetEventAddOrRemoveMethod(@event, @event.AddMethod, throughMember, generator.AddEventHandler),
Microsoft.CodeAnalysis.CSharp (1)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
227var accessor = symbol.AddMethod ?? symbol.RemoveMethod;
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
113if (ev.AddMethod is { DeclaringSyntaxReferences.Length: 0 })
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (3)
106var declaration = !info.Context.GenerateMethodBodies || @event.IsAbstract || @event.AddMethod == null || @event.RemoveMethod == null 145GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 229if (@event.AddMethod?.IsReadOnly == true && !@event.ContainingType.IsReadOnly)
Microsoft.CodeAnalysis.CSharp.Features (8)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (7)
1242if (oldEventSymbol.AddMethod != null || newEventSymbol.AddMethod != null) 1244if (DiffersInReadOnlyModifier(oldEventSymbol.AddMethod, newEventSymbol.AddMethod) || 1247result.Add((oldEventSymbol.AddMethod, newEventSymbol.AddMethod, editKind)); 1976=> symbol.AddMethod?.IsImplicitlyDeclared != false ? CSharpFeaturesResources.event_field : base.GetDisplayName(symbol);
src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
113if (ev.AddMethod is { DeclaringSyntaxReferences.Length: 0 })
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\ReadOnlyStructsTests.cs (2)
1208Assert.True(getEvent(s1, "E").AddMethod.IsReadOnly); 1224Assert.True(getEvent(s2, "E").AddMethod.IsReadOnly);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (1)
390Assert.Same(eventSymbol.AddMethod, model.GetDeclaredSymbol(accessorList[0]));
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (3)
106var declaration = !info.Context.GenerateMethodBodies || @event.IsAbstract || @event.AddMethod == null || @event.RemoveMethod == null 145GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 229if (@event.AddMethod?.IsReadOnly == true && !@event.ContainingType.IsReadOnly)
Microsoft.CodeAnalysis.Features (3)
PullMemberUp\MembersPuller.cs (2)
233(eventSymbol.AddMethod != null && !eventSymbol.AddMethod.IsImplicitlyDeclared) ||
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
244addMethod: GetEventAddOrRemoveMethod(@event, @event.AddMethod, throughMember, generator.AddEventHandler),
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\EventSymbol.vb (1)
290Private ReadOnly Property IEventSymbol_AddMethod As IMethodSymbol Implements IEventSymbol.AddMethod
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EventGenerator.vb (3)
83([event].AddMethod IsNot Nothing OrElse [event].RemoveMethod IsNot Nothing OrElse [event].RaiseMethod IsNot Nothing) Then 95[event].AddMethod Is Nothing, 97GenerateStatements([event].AddMethod))
Microsoft.CodeAnalysis.VisualBasic.Features (4)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (4)
852If oldEventSymbol.AddMethod IsNot Nothing OrElse newEventSymbol.AddMethod IsNot Nothing Then 854result.Add((oldEventSymbol.AddMethod, newEventSymbol.AddMethod, editKind))
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Semantics\GetSemanticInfoTests.vb (1)
3109Assert.Equal(handledEvent0.EventSymbol.AddMethod, commonEventSymbol.AddMethod)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EventGenerator.vb (3)
83([event].AddMethod IsNot Nothing OrElse [event].RemoveMethod IsNot Nothing OrElse [event].RaiseMethod IsNot Nothing) Then 95[event].AddMethod Is Nothing, 97GenerateStatements([event].AddMethod))
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
CodeModel\MethodXML\MethodXmlBuilder.vb (1)
129eventAccessor = eventSymbol?.AddMethod