VarDeclaration
Render a variable declaration
Props for VarDeclaration component
import { VarDeclaration } from "@alloy-js/csharp";
<VarDeclaration const name={string | Namekey} refkey={Refkey} type={Children} using> {children}</VarDeclaration>import { VarDeclaration } from "@alloy-js/csharp/stc";
VarDeclaration({ const: boolean, name: string | Namekey, refkey: Refkey, type: Children, using: boolean,}).children(children)| children | optional Children | Variable value |
| const | optional boolean | Constant variable. Add the const modifier. |
| name | string | Namekey | Variable name |
| refkey | optional Refkey | Variable refkey |
| type | optional Children | Type of the variable declaration. If not specified, defaults to “var” |
| using | optional boolean | Disposable variable. Add the using modifier. |
Examples
Section titled “Examples”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;