Skip to content

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
/>
abstractoptional boolean
attributesoptional AttributesPropDefine attributes to attach
docoptional ChildrenDoc comment
externoptional boolean
fileoptional boolean
getoptional boolean | ChildrenIf property should have a getter. Pass true for an auto-property getter (get;), or pass children for a getter with a body.
initoptional booleanIf property should only be set on the type creation
initializeroptional ChildrenProperty initializer
internaloptional boolean
nameNamekey | string
newoptional boolean
nullableoptional booleanProperty initializer
overrideoptional boolean
privateoptional boolean
protectedoptional boolean
publicoptional boolean
readonlyoptional boolean
refkeyoptional Refkey
requiredoptional booleanSet required modifier on property https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required
sealedoptional boolean
setoptional boolean | ChildrenIf property should have a setter. Pass true for an auto-property setter (set;), or pass children for a setter with a body.
staticoptional boolean
typeChildrenProperty type
virtualoptional boolean
<ClassProperty public name="My" get set />
public int My { get; set; };