public static CsCodeWriter SingleLineForeach(this CsCodeWriter cs, string variable, string collection, string statement) { cs.WriteLine($"foreach (var {variable} in {collection})"); cs.IncIndent(); cs.WriteLine(statement); cs.DecIndent(); return(cs); }
public void CreateArray(CsCodeWriter c, string prefix) { c.Open(prefix + "new []"); var lastIdx = Arguments.Length - 1; for (var index = 0; index <= lastIdx; index++) { var i = Arguments[index]; if (index < lastIdx) { i += ","; } c.WriteLine(i); } c.DecIndent(); c.WriteLine("};"); }