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


C# Variant.CompareTo方法代码示例

本文整理汇总了C#中Variant.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.CompareTo方法的具体用法?C# Variant.CompareTo怎么用?C# Variant.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Variant的用法示例。


在下文中一共展示了Variant.CompareTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestComparison

        public void TestComparison()
        {
            Variant v1 = new Variant(new TestObject1("some value"));
            Variant v2 = new Variant(new TestObject1("some other value"));
            Variant v3 = new Variant(new TestObject2("some value"));

            Assert.AreEqual(0, v1.CompareTo(v1));
            Assert.AreEqual(1, v1.CompareTo(v2));
            Assert.AreEqual(-1, v2.CompareTo(v1));
            Assert.AreEqual(-1, v1.CompareTo(v3));
            Assert.AreEqual(1, v3.CompareTo(v1));
        }
开发者ID:proteanic,项目名称:protean,代码行数:12,代码来源:TestObject.cs

示例2: TestComparison

        public void TestComparison()
        {
            Variant v1 = new Variant(new byte[] { 0x01, 0x02, 0x03 });
            Variant v2 = new Variant(new byte[] { 0x01, 0x02, 0x04 });
            Variant v3 = new Variant(new byte[] { 0x01, 0x02, 0x03, 0x04 });

            Assert.AreEqual(0, v1.CompareTo(v1));
            Assert.AreEqual(-1, v1.CompareTo(v2));
            Assert.AreEqual(1, v2.CompareTo(v1));
            Assert.AreEqual(-1, v1.CompareTo(v3));
            Assert.AreEqual(1, v3.CompareTo(v1));
        }
开发者ID:proteanic,项目名称:protean,代码行数:12,代码来源:TestBuffer.cs

示例3: 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


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