本文整理汇总了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);
}