本文整理匯總了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) + ");");
}
}