CompareHelper
Provides helper methods for comparing various types including IPAddress, Type, object, and Version.
メソッド
public static int Compare(IPAddress first, IPAddress second)
result = CompareHelper.Compare(first, second)
Compares two IPAddress instances by converting them to a numeric value.
- first
- The first IPAddress to compare.
- second
- The second IPAddress to compare.
戻り値: A signed integer that indicates the relative values of the two IP addresses. Less than zero if first is less than second, zero if equal, and greater than zero if first is greater than second.
public static bool Compare(Type first, Type second, bool useInheritance)
result = CompareHelper.Compare(first, second, useInheritance)
Compares two Type instances for equality with an option to consider inheritance.
- first
- The first Type to compare.
- second
- The second Type to compare.
- useInheritance
- If set to true, uses inheritance to determine equality.
戻り値: True if the types are considered equal; otherwise, false.
public static int Compare(Type first, Type second)
result = CompareHelper.Compare(first, second)
Compares two Type instances with inheritance ordering.
- first
- The first Type to compare.
- second
- The second Type to compare.
戻り値: 0 if the types are identical; 1 if is assignable from ; otherwise, -1.
public static int Compare(object value1, object value2)
result = CompareHelper.Compare(value1, value2)
Compares two objects of the same type that implement IComparable.
- value1
- The first object to compare.
- value2
- The second object to compare.
戻り値: A signed integer that indicates the relative values of the two objects. Less than zero if is less than , zero if equal, and greater than zero if greater.
public static int Compare(Version first, Version second)
result = CompareHelper.Compare(first, second)
Compares two Version instances.
- first
- The first Version to compare.
- second
- The second Version to compare.
戻り値: A signed integer that indicates the relative values of the two versions. Less than zero if is less than , zero if equal, and greater than zero if greater.
public static bool IsDefault<T>(T value)
result = CompareHelper.IsDefault(value)
Determines whether a value is equal to its default value.
- value
- The value to check.
戻り値: True if the value equals the default value of its type; otherwise, false.
public static bool IsRuntimeDefault<T>(T value)
result = CompareHelper.IsRuntimeDefault(value)
Determines whether a value is equal to the default value as computed at runtime.
- value
- The value to check.
戻り値: True if the value equals the runtime default value; otherwise, false.