本文整理汇总了C#中Variant.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.Equals方法的具体用法?C# Variant.Equals怎么用?C# Variant.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variant
的用法示例。
在下文中一共展示了Variant.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestComparison
public void TestComparison()
{
TypedArray a1 = new TypedArray(Variant.EnumType.Double, 2);
a1[0] = 1.0;
a1[1] = 2.0;
Variant v1 = new Variant(a1);
TypedArray a2 = new TypedArray(Variant.EnumType.Double, 2);
a2[0] = 1.0;
a2[1] = 2.0;
Variant v2 = new Variant(a2);
TypedArray a3 = new TypedArray(Variant.EnumType.Double, 2);
a3[0] = 2.0;
a3[1] = 1.0;
Variant v3 = new Variant(a3);
Assert.IsTrue(v1.Equals(v2));
Assert.IsFalse(v1.Equals(v3));
Assert.AreEqual(0, v1.CompareTo(v2));
Assert.AreEqual(-1, v2.CompareTo(v3));
Assert.AreEqual(1, v3.CompareTo(v2));
}
示例2: TestStreams
public void TestStreams()
{
Variant dict = new Variant(Variant.EnumType.Dictionary);
dict.Add("key1", new Variant("value1"));
dict.Add("key2", new Variant("value2"));
Variant input = new Variant(Variant.EnumType.List);
for (int i = 0; i < 10000; ++i)
{
input.Add(dict);
}
System.IO.MemoryStream istream = new System.IO.MemoryStream();
using(BinaryWriter writer = new BinaryWriter(istream))
{
writer.Write(input);
}
Variant output;
System.IO.MemoryStream ostream = new System.IO.MemoryStream(istream.GetBuffer());
using (BinaryReader reader = new BinaryReader(ostream))
{
output = reader.Read();
}
Assert.True(input.Equals(output));
}
示例3: TestBytes
public void TestBytes()
{
Variant dict = new Variant(Variant.EnumType.Dictionary);
dict.Add("key1", new Variant("value1"));
dict.Add("key2", new Variant("value2"));
Variant input = new Variant(Variant.EnumType.List);
for (int i = 0; i < 10000; ++i)
{
input.Add(dict);
}
byte[] bytes = BinaryWriter.ToBytes(input);
Variant output = BinaryReader.FromBytes(bytes);
Assert.True(input.Equals(output));
}
示例4: TestDictionary
public void TestDictionary()
{
Variant input = new Variant(Variant.EnumType.Dictionary);
input.Add("key1", new Variant("value1"));
input.Add("key2", new Variant("value2"));
StringBuilder ibuffer = new StringBuilder();
System.IO.StringWriter istream = new System.IO.StringWriter(ibuffer);
XMLWriter writer = new XMLWriter(istream);
writer.Write(input);
System.IO.StringReader ostream = new System.IO.StringReader(ibuffer.ToString());
XMLReader reader = new XMLReader(ostream);
Variant output = reader.Read();
Assert.True(input.Equals(output));
}