Property
Render a C# class property.
Properties for Property component
import { Property } from "@alloy-js/csharp";
<Property abstract attributes={AttributesProp} doc={Children} extern file get={boolean | Children} init initializer={Children} internal name={Namekey | string} new nullable override private protected public readonly refkey={Refkey} required sealed set={boolean | Children} static type={Children} virtual />import { Property } from "@alloy-js/csharp/stc";
Property({ abstract: boolean, attributes: AttributesProp, doc: Children, extern: boolean, file: boolean, get: boolean | Children, init: boolean, initializer: Children, internal: boolean, name: Namekey | string, new: boolean, nullable: boolean, override: boolean, private: boolean, protected: boolean, public: boolean, readonly: boolean, refkey: Refkey, required: boolean, sealed: boolean, set: boolean | Children, static: boolean, type: Children, virtual: boolean,}).children(children)| abstract | optional boolean | |
| attributes | optional AttributesProp | Define attributes to attach |
| doc | optional Children | Doc comment |
| extern | optional boolean | |
| file | optional boolean | |
| get | optional boolean | Children | If property should have a getter. Pass true for an auto-property getter (get;), or pass children for a getter with a body. |
| init | optional boolean | If property should only be set on the type creation |
| initializer | optional Children | Property initializer |
| internal | optional boolean | |
| name | Namekey | string | |
| new | optional boolean | |
| nullable | optional boolean | Property initializer |
| override | optional boolean | |
| private | optional boolean | |
| protected | optional boolean | |
| public | optional boolean | |
| readonly | optional boolean | |
| refkey | optional Refkey | |
| required | optional boolean | Set required modifier on property https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required |
| sealed | optional boolean | |
| set | optional boolean | Children | If property should have a setter. Pass true for an auto-property setter (set;), or pass children for a setter with a body. |
| static | optional boolean | |
| type | Children | Property type |
| virtual | optional boolean |
Example
Section titled “Example”<ClassProperty public name="My" get set />
public int My { get; set; };