There are other questions here which seem to address this question with older versions of the CTP, but they do not appear to work anymore with the latest release. I’m trying to figure out how to change the declaration from int to var. SyntaxKind.VarKeyword is no longer available to me.
Syntax.VariableDeclaration(
Syntax.PredefinedType(Syntax.Token(SyntaxKind.IntKeyword)),
Syntax.SeparatedList(Syntax.VariableDeclarator(Syntax.Identifier(name)))))
varis not actually a keyword in the language, so we removed it. You can simply create an identifier named “var” and that will work. Note however, that if there happened to be a type in scope named var, that would be used.Something like:
Though note that for type inference to work you will need to provide an
EqualsValueClauseSyntaxto youVariableDeclaratoras well.