本文整理汇总了C#中ILocation.GetParts方法的典型用法代码示例。如果您正苦于以下问题:C# ILocation.GetParts方法的具体用法?C# ILocation.GetParts怎么用?C# ILocation.GetParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILocation
的用法示例。
在下文中一共展示了ILocation.GetParts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateCloseness
public static int? CalculateCloseness(this ILocation locationA, ILocation locationB, StringComparison comparisonType = StringComparison.InvariantCultureIgnoreCase)
{
var sequenceA = locationA.GetParts();
var sequenceB = locationB.GetParts();
return sequenceA.CalculateCloseness(sequenceB, comparisonType);
}
示例2: CompareByParts
public static int CompareByParts(this ILocation location1, ILocation location2)
{
var location1Parts = (location1 == null) ? (new string[0]) : (location1.GetParts().ToArray());
var location2Parts = (location2 == null) ? (new string[0]) : (location2.GetParts().ToArray());
for (var i = 0; i < location1Parts.Length && i < location2Parts.Length; i++)
{
var location1Part = location1Parts[i];
var location2Part = location2Parts[i];
var result = string.Compare(location1Part, location2Part, StringComparison.InvariantCultureIgnoreCase);
if (result != 0)
{
return result;
}
}
if (location1Parts.Length < location2Parts.Length)
{
return -1;
}
else if (location1Parts.Length > location2Parts.Length)
{
return 1;
}
return 0;
}
示例3: Equals
public static bool Equals(this ILocation a, ILocation b)
{
if (a == null && b == null)
{
return true;
}
if ((a == null) ^ (b == null))
{
return false;
}
var result = a.GetParts().SequenceEqual(b.GetParts());
return result;
}
示例4: Update
public static void Update(this ILocation destination, ILocation source)
{
destination.Update(source.GetParts());
}