2 overrides of FieldDeclaration
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
CodeGeneration\CSharpSyntaxGenerator.cs (1)
170
public override SyntaxNode
FieldDeclaration
(
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
CodeGeneration\VisualBasicSyntaxGenerator.vb (1)
677
Public Overrides Function
FieldDeclaration
(name As String, type As SyntaxNode, Optional accessibility As Accessibility = Nothing, Optional modifiers As DeclarationModifiers = Nothing, Optional initializer As SyntaxNode = Nothing) As SyntaxNode
65 references to FieldDeclaration
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
85
.
FieldDeclaration
(
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (33)
CodeGeneration\SyntaxGeneratorTests.cs (33)
781
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32)),
785
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), initializer: Generator.LiteralExpression(0)),
789
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public),
793
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Static | DeclarationModifiers.ReadOnly),
797
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Required),
1558
Generator.ClassDeclaration("c", members: [Generator.
FieldDeclaration
("y", type: Generator.IdentifierName("x"))]),
1594
Generator.StructDeclaration("s", members: [Generator.
FieldDeclaration
("y", Generator.IdentifierName("x"))]),
1658
Generator.InterfaceDeclaration("i", members: [Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]),
1696
Generator.EnumDeclaration("e", members: [Generator.
FieldDeclaration
("a", Generator.IdentifierName("e"), initializer: Generator.LiteralExpression(1))]),
1844
Generator.
FieldDeclaration
("y", Generator.IdentifierName("x")),
1851
Generator.
FieldDeclaration
("y", Generator.IdentifierName("x")),
2884
Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"))));
2907
Assert.Equal("f", Generator.GetName(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"))));
2930
Assert.Equal("f", Generator.GetName(Generator.WithName(Generator.
FieldDeclaration
("x", Generator.IdentifierName("t")), "f")));
2953
Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal)));
2977
Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private)));
3001
Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Const)));
3024
Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.WithModifiers(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t")), DeclarationModifiers.Const)));
3062
Generator.GetModifiers(Generator.WithModifiers(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t")), allModifiers)));
3197
Assert.Equal("t", Generator.GetType(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"))).ToString());
3218
Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.
FieldDeclaration
("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString());
3282
Assert.Equal("x", Generator.GetExpression(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString());
3316
Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString());
3852
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3860
Generator.InsertMembers(declC, 1, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3869
Generator.InsertMembers(declC, 2, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3878
Generator.InsertMembers(declC, 3, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3967
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3985
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
4006
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
4024
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
4096
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
4114
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
Microsoft.CodeAnalysis.Features (1)
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
85
.
FieldDeclaration
(
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (23)
CodeGeneration\SyntaxGeneratorTests.vb (23)
828
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32)),
832
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), initializer:=Generator.LiteralExpression(0)),
836
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility:=Accessibility.Public),
840
Generator.
FieldDeclaration
("fld", Generator.TypeExpression(SpecialType.System_Int32), modifiers:=DeclarationModifiers.Static Or DeclarationModifiers.ReadOnly Or DeclarationModifiers.WithEvents),
1440
Generator.ClassDeclaration("c", members:={Generator.
FieldDeclaration
("y", type:=Generator.IdentifierName("x"))}),
1485
Generator.StructDeclaration("s", members:={Generator.
FieldDeclaration
("y", Generator.IdentifierName("x"))}),
2133
Generator.
FieldDeclaration
("y", Generator.IdentifierName("x")),
2141
Generator.
FieldDeclaration
("y", Generator.IdentifierName("x")),
2579
Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"))))
2604
Assert.Equal("f", Generator.GetName(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"))))
2629
Assert.Equal("f", Generator.GetName(Generator.WithName(Generator.
FieldDeclaration
("x", Generator.IdentifierName("t")), "f")))
2651
Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal)))
2679
Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), accessibility:=Accessibility.Internal), Accessibility.Private)))
2706
Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), modifiers:=DeclarationModifiers.Const)))
2728
Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.WithModifiers(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t")), DeclarationModifiers.Const)))
2767
Assert.Equal("t", Generator.GetType(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"))).ToString())
2788
Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.
FieldDeclaration
("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString())
2881
Assert.Equal("x", Generator.GetExpression(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t"), initializer:=Generator.IdentifierName("x"))).ToString())
2899
Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.
FieldDeclaration
("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString())
3553
Generator.InsertMembers(declC, 0, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3563
Generator.InsertMembers(declC, 1, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3575
Generator.InsertMembers(declC, 2, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
3587
Generator.InsertMembers(declC, 3, Generator.
FieldDeclaration
("A", Generator.IdentifierName("T"))),
Microsoft.CodeAnalysis.Workspaces (1)
Editing\SyntaxGenerator.cs (1)
144
return
FieldDeclaration
(
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
Editing\SyntaxEditorTests.cs (5)
52
editor.ReplaceNode(fieldX, editor.Generator.
FieldDeclaration
("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
103
editor.InsertAfter(fieldX, editor.Generator.
FieldDeclaration
("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
130
editor.InsertBefore(fieldX, editor.Generator.
FieldDeclaration
("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
178
editor.InsertAfter(fieldX, editor.Generator.
FieldDeclaration
("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
179
editor.InsertBefore(fieldX, editor.Generator.
FieldDeclaration
("Z", editor.Generator.TypeExpression(SpecialType.System_Object), Accessibility.Public));
SyntaxNodeTests.cs (1)
103
var cgenField = gen.
FieldDeclaration
("X", gen.TypeExpression(SpecialType.System_Int32), Accessibility.Private);