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 | optionalChildrenVariable value |
| const | optionalbooleanConstant variable. Add the const modifier. |
| name | string | NamekeyVariable name |
| refkey | optionalRefkeyVariable refkey |
| type | optionalChildrenType of the variable declaration. If not specified, defaults to “var” |
| using | optionalbooleanDisposable 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;