本文整理匯總了C#中Chain.Link方法的典型用法代碼示例。如果您正苦於以下問題:C# Chain.Link方法的具體用法?C# Chain.Link怎麽用?C# Chain.Link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Chain
的用法示例。
在下文中一共展示了Chain.Link方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Base64SerializationMassTest
public void Base64SerializationMassTest()
{
// TODO: can i do something to speed up deserialization
// (ca 35MB for 421337 PrimitiveGenerators in ca 21s)
var generatorCount = 421337u;
var chain = new Chain<List<GameObject>> ();
for (var i = 0u; i < generatorCount; ++i) {
chain.Link (new PrimitveGenerator (PrimitiveType.Cylinder, i + 1u));
}
var serialized = new Base64DeSerializer<Chain<List<GameObject>>> (chain);
Assert.IsNotEmpty (serialized.Serialized);
Assert.AreEqual (chain, serialized.Data);
var byteSize = serialized.Serialized.Length * sizeof (Char);
Console.WriteLine ("Serialized data is " + byteSize + " bytes.");
var deserialized = new Base64DeSerializer<Chain<List<GameObject>>> (serialized.Serialized);
Assert.AreEqual (serialized.Serialized, deserialized.Serialized);
Assert.AreEqual (serialized.Data.Elements.Count, deserialized.Data.Elements.Count);
}
示例2: TestTypeMismatch
public void TestTypeMismatch()
{
Chain<int, int> chain = new Chain<int, int>();
chain.Link<int>(x => x + 1)
.Link<string>(x => x)
.Link<int>(x => x);
LinkArgumentException laErr = null;
try
{
int output = chain.Execute(0);
}
catch (LinkArgumentException lae)
{
laErr = lae;
}
Assert.IsNotNull(laErr);
}