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


C# SqlGuid.CompareTo方法代码示例

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


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

示例1: CompareTo

                public void CompareTo()
                {
			String TestString = "This is a test string";
			SqlGuid test1 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
			SqlGuid test2 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
			SqlGuid test3 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
                        Assert.IsTrue (Test1.CompareTo (Test3) <  0, "#D01");
                        Assert.IsTrue (Test4.CompareTo (Test1) > 0, "#D02");
                        Assert.IsTrue (Test3.CompareTo (Test2) == 0, "#D03");
                        Assert.IsTrue (Test4.CompareTo (SqlGuid.Null) > 0, "#D04");
			Assert.IsTrue (test1.CompareTo (test2) >  0, "#D05");
			Assert.IsTrue (test3.CompareTo (test2) <  0, "#D06");
			
                        try {
                                Test1.CompareTo (TestString);
                                Assert.Fail("#D05");
                        } catch(Exception e) {
                                Assert.AreEqual (typeof (ArgumentException), e.GetType (), "#D06");
                        }
                }
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:20,代码来源:SqlGuidTest.cs

示例2: GreaterThanOrEqual

        public static SqlBoolean GreaterThanOrEqual(SqlGuid x, SqlGuid y)
        {
            if(x.IsNull || y.IsNull)
                return SqlBoolean.Null;

            int res = x.CompareTo(y);
            if(res >= 0)
                return SqlBoolean.True;
            return SqlBoolean.False;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:SqlGuid.cs

示例3: CompareTo

                public void CompareTo()
                {
			String TestString = "This is a test string";
			SqlGuid test1 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
			SqlGuid test2 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
			SqlGuid test3 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
                        Assert ("#D01", Test1.CompareTo (Test3) <  0);
                        Assert ("#D02", Test4.CompareTo (Test1) > 0);
                        Assert ("#D03", Test3.CompareTo (Test2) == 0);
                        Assert ("#D04", Test4.CompareTo (SqlGuid.Null) > 0);
			Assert ("#D05", test1.CompareTo (test2) >  0);
			Assert ("#D06", test3.CompareTo (test2) <  0);
			
                        try {
                                Test1.CompareTo (TestString);
                                Fail("#D05");
                        } catch(Exception e) {
                                AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());
                        }
                }
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:20,代码来源:SqlGuidTest.cs

示例4: LessThan

        public static SqlBoolean LessThan(SqlGuid x, SqlGuid y)
        {
            if(x.IsNull || y.IsNull)
                return SqlBoolean.Null;

            int res = x.CompareTo(y);
            if(res < 0)
                return SqlBoolean.True;
            return SqlBoolean.False;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:SqlGuid.cs

示例5: CompareTo

        public void CompareTo()
        {
            string TestString = "This is a test string";
            SqlGuid test1 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
            SqlGuid test2 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
            SqlGuid test3 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
            Assert.True(_test1.CompareTo(_test3) < 0);
            Assert.True(_test4.CompareTo(_test1) > 0);
            Assert.True(_test3.CompareTo(_test2) == 0);
            Assert.True(_test4.CompareTo(SqlGuid.Null) > 0);
            Assert.True(test1.CompareTo(test2) > 0);
            Assert.True(test3.CompareTo(test2) < 0);

            try
            {
                _test1.CompareTo(TestString);
                Assert.False(true);
            }
            catch (Exception e)
            {
                Assert.Equal(typeof(ArgumentException), e.GetType());
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:23,代码来源:SqlGuidTest.cs


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