本文整理汇总了C#中CodeBlock.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# CodeBlock.WriteLine方法的具体用法?C# CodeBlock.WriteLine怎么用?C# CodeBlock.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeBlock
的用法示例。
在下文中一共展示了CodeBlock.WriteLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTest
private static void CreateTest(CodeBlock c, string permutation, string sourceSymbols)
{
var code = c.Code;
c.WriteLine("[Test]");
var initValue = GetRandomInitValue(sourceSymbols);
using (var m = Block("public void " + permutation + "_Definition()", code))
{
m.WriteLine("var value = new Vector" + sourceSymbols.Length + "(" + string.Join(",", initValue) + ");");
m.WriteLine(GetExpectedLine(permutation, sourceSymbols, initValue));
m.WriteLine("Assert.AreEqual(expected, value." + permutation + "());");
}
}
示例2: CreateImplementation
private static void CreateImplementation(CodeBlock c, string permutation, string sourceSymbols)
{
var code = c.Code;
int outSize = permutation.Length;
int inSize = sourceSymbols.Length;
string[] components = permutation.Select(symbol => string.Concat("v.", char.ToLower(symbol))).ToArray();
string docSourceVec = string.Join(",", sourceSymbols.Select(s => s.ToString()).ToArray());
string docPermVec = string.Join(",", permutation.Select(s => s.ToString()).ToArray());
c.WriteLine("///<summary>");
c.WriteLine("/// Give a vector (" + docSourceVec + ") returns a vector (" + docPermVec + ")");
c.WriteLine("///</summary>");
using (var m = Block("public static Vector" + outSize + " " + permutation + "(this Vector" + inSize + " v)", code))
{
m.WriteLine("return new Vector" + outSize + "(" + string.Join(",", components) + ");");
}
}