本文整理汇总了C#中Tuple.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Tuple.GetType方法的具体用法?C# Tuple.GetType怎么用?C# Tuple.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tuple
的用法示例。
在下文中一共展示了Tuple.GetType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DynamicCreateLongTypedTuple
public void DynamicCreateLongTypedTuple()
{
object tup = Tupler.Create(1, "2", "3", 4,
5, 6, 7, "8", "9", 10, "11", 12);
var tup2 = new Tuple<int, string, string, int, int, int, int, Tuple<string, string, int, string, int>>(
1, "2", "3", 4,
5, 6, 7, Tuple.Create("8", "9", 10, "11", 12)
);
Assert.That(tup, Is.TypeOf(tup2.GetType()));
Assert.That(tup, Is.EqualTo(tup2));
}
示例2: Main
public static void Main(string[] args)
{
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201408/20140809/linq-jvm
// X:\jsc.svn\examples\java\Test\TestNewArrayGenericImport\TestNewArrayGenericImport\Class1.cs
// X:\jsc.svn\examples\java\Test\TestLocalGenericArgumentReference\TestLocalGenericArgumentReference\Class1.cs
System.Console.WriteLine(
typeof(object).AssemblyQualifiedName
);
var z = new Tuple<MemberInfo, int>[] {
// Tuple.Create(item.m, index)
};
Console.WriteLine(z.GetType().FullName);
CLRProgram.CLRMain();
}
示例3: TupleCollection2
public void TupleCollection2()
{
var value = new Tuple<Int32,String,Boolean> (1, "jeb", false);
var data = "0a01010a04036a65620a0100";
var encodeResult = Encoder.Encode (value, value.GetType ());
Assert.AreEqual (data, Hexlify (encodeResult));
Tuple<Int32,String,Boolean> decodeResult = (Tuple<Int32,String,Boolean>)Encoder.Decode (Unhexlify (data), value.GetType (), null);
Assert.AreEqual (value, decodeResult);
}
示例4: TupleCollection1
public void TupleCollection1()
{
var value = new Tuple<Int32> (1);
var data = "0a0101";
var encodeResult = Encoder.Encode (value, value.GetType ());
Assert.AreEqual (data, Hexlify (encodeResult));
Tuple<Int32> decodeResult = (Tuple<Int32>)Encoder.Decode (Unhexlify (data), value.GetType (), null);
Assert.AreEqual (value, decodeResult);
}
示例5: TupleCollection2
public void TupleCollection2 ()
{
var value = new Tuple<int,string,bool> (1, "jeb", false);
const string data = "0a01010a04036a65620a0100";
var encodeResult = Encoder.Encode (value, value.GetType ());
Assert.AreEqual (data, encodeResult.ToHexString ());
var decodeResult = (Tuple<int,string,bool>)Encoder.Decode (data.ToByteString (), value.GetType (), null);
Assert.AreEqual (value, decodeResult);
}
示例6: TupleCollection1
public void TupleCollection1 ()
{
var value = new Tuple<int> (1);
const string data = "0a0101";
var encodeResult = Encoder.Encode (value, value.GetType ());
Assert.AreEqual (data, encodeResult.ToHexString ());
var decodeResult = (Tuple<int>)Encoder.Decode (data.ToByteString (), value.GetType (), null);
Assert.AreEqual (value, decodeResult);
}
示例7: MethodCallTestMethod
private static int MethodCallTestMethod(int arg)
{
var a = new Tuple<int, int>(arg, -arg);
return a.GetType().GetHashCode();
}
示例8: TupleKeyInfoHelper_KeyMemberSelectorLarge2
public void TupleKeyInfoHelper_KeyMemberSelectorLarge2()
{
var tuple =
new Tuple<int, int, int, int, int, int, int,
Tuple<int, int, int, int, int, int, int,
Tuple<int, int>>>(
1, 2, 3, 4, 5, 6, 7,
new Tuple<int, int, int, int, int, int, int, Tuple<int, int>>(
8, 9, 10, 11, 12, 13, 14, Tuple.Create(15, 16)));
TupleKeyInfoHelper builder = new TupleKeyInfoHelper(tuple.GetType());
Expression source = Expression.Constant(tuple);
Expression selector = builder.CreateKeyMemberSelectorExpression(source, 15);
int result = (int)Expression.Lambda(selector).Compile().DynamicInvoke();
Assert.AreEqual(16, result);
}