PropertyDeclaration Class
Represents a property declaration.
public class PropertyDeclaration : MemberDeclarationExample
var prop = new PropertyDeclaration("Name", typeof(string));
prop.Modifiers = Modifiers.Public;
prop.Getter = new ReturnStatement(new MemberReferenceExpression(new ThisExpression(), "_name"));
prop.Setter = new AssignStatement(new MemberReferenceExpression(new ThisExpression(), "_name"), new ValueArgumentExpression());
Assert.Equal("""
public string Name
{
get
{
return this._name;
}
set
{
this._name = value;
}
}
""", prop.ToCsharpString());- Inheritance
MemberDeclarationPropertyDeclaration
Constructors
| Name | Description |
|---|---|
| PropertyDeclaration() | |
| PropertyDeclaration(string?, TypeReference?) | Initializes a new instance of the PropertyDeclaration class with the specified name and type. |
PropertyDeclaration overloads
PropertyDeclaration()
PropertyDeclaration.cspublic PropertyDeclaration()No documentation is available.
PropertyDeclaration(string?, TypeReference?)
PropertyDeclaration.csInitializes a new instance of the PropertyDeclaration class with the specified name and type.
public PropertyDeclaration(string? name, TypeReference? type)Parameters
namestring?- The property name.
typeTypeReference?- The property type.
Properties
| Name | Description |
|---|---|
| Getter | |
| Modifiers | |
| PrivateImplementationType | |
| Setter | |
| Type |
Getter
PropertyDeclaration.cspublic PropertyAccessorDeclaration? Getter { get; set; }Property value
No documentation is available.
Modifiers
PropertyDeclaration.csPrivateImplementationType
PropertyDeclaration.cspublic TypeReference? PrivateImplementationType { get; set; }Property value
No documentation is available.
Setter
PropertyDeclaration.cspublic PropertyAccessorDeclaration? Setter { get; set; }Property value
No documentation is available.