Skip to content

VarDeclaration

Render a variable declaration

Props for VarDeclaration component

import { VarDeclaration } from "@alloy-js/csharp";
<VarDeclaration name="string" refkey={Refkey} type={Children}>
{children}
</VarDeclaration>
childrenoptionalChildren

Variable value

namestring

Variable name

refkeyoptionalRefkey

Variable refkey

typeoptionalChildren

Type of the variable declaration. If not specified, defaults to “var”

with var

<VarDeclaration name="myVar">42</VarDeclaration>

This will render:

var myVar = 42;

with type

<VarDeclaration name="myVar" type="int">42</VarDeclaration>

This will render:

int myVar = 42;