本文整理汇总了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));
}
示例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);
}
示例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));
}