当前位置: 首页>>代码示例>>C#>>正文


C# Variant.Equals方法代码示例

本文整理汇总了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));
        }
开发者ID:proteanic,项目名称:protean,代码行数:27,代码来源:TestArray.cs

示例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));
                }
开发者ID:rokstrnisa,项目名称:protean,代码行数:27,代码来源:TestBinaryStreams.cs

示例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));
                }
开发者ID:rokstrnisa,项目名称:protean,代码行数:17,代码来源:TestBinaryStreams.cs

示例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));
                }
开发者ID:rokstrnisa,项目名称:protean,代码行数:17,代码来源:TestXMLStreams.cs


注:本文中的Variant.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。