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


C# ScrReference.CompareTo方法代码示例

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


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

示例1: CompareTo_int

		public void CompareTo_int()
		{
			ScrReference ref1 = new ScrReference("GEN 30:1", ScrVers.Original);
			Assert.AreEqual(0, ref1.CompareTo(1030001));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:5,代码来源:ScrReferenceTests.cs

示例2: CompareTo

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Compares the current instance with another object of the same type.
		/// </summary>
		/// <param name="obj">An object to compare with this instance.</param>
		/// <returns>
		/// A 32-bit signed integer that indicates the relative order of the objects being
		/// compared. The return value has these meanings:
		///
		/// Value				Meaning
		/// Less than zero		This instance is less than <paramref name="obj"/>.
		/// Zero				This instance is equal to <paramref name="obj"/>.
		/// Greater than zero	This instance is greater than <paramref name="obj"/>.
		/// </returns>
		/// <exception cref="T:System.ArgumentException">
		/// 	<paramref name="obj"/> is not the same type as this instance. </exception>
		/// ------------------------------------------------------------------------------------
		public override int CompareTo(object obj)
		{
			if (obj == null)
			if (!(obj is ScrReference))
				throw new ArgumentException();

			ScrReference right = (ScrReference)obj;

			// If versifications don't match, make a new one, converted to correct versification
			if (m_versification != right.m_versification &&
				m_versification != Paratext.ScrVers.Unknown &&
				right.m_versification != Paratext.ScrVers.Unknown)
			{
				// Neither of the versifications involved are unknown, so do a normal conversion
				right = new ScrReference(right, m_versification);
			}
			else if (m_versification != right.m_versification)
			{
				// one of the versifications involved is unknown, so just treat it as the same
				// versification as the known one.
				if (right.m_versification != Paratext.ScrVers.Unknown)
				{
					ScrReference newThis = new ScrReference(BBCCCVVV, right.m_versification);
					return newThis.CompareTo(right);
				}

				right = new ScrReference(right.BBCCCVVV, m_versification);
			}

			return base.CompareTo(right);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:48,代码来源:ScrReference.cs

示例3: CompareTo_BCVRef

		public void CompareTo_BCVRef()
		{
			ScrReference ref1 = new ScrReference("GEN 30:1", ScrVers.Original);
			BCVRef ref2 = new BCVRef("GEN 30:1");
			Assert.AreEqual(0, ref1.CompareTo(ref2));
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:6,代码来源:ScrReferenceTests.cs


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