コード例 #1
0
 /// <summary>
 /// Method for value comparison of fraction and number
 /// </summary>
 /// <returns>
 /// 0: if they are equal
 /// 1: if fraction > number
 /// -1: if number > fraction
 /// </returns>
 public static int Compare(Fraction fraction, int number)
 {
     return fraction.CompareTo(number);
 }
コード例 #2
0
 /// <summary>
 /// Method for value comparison of fraction and number
 /// </summary>
 /// <returns>
 /// 0: if they are equal
 /// 1: if number > fraction
 /// -1: if fraction > number
 /// </returns>
 public static int Compare(int number, Fraction fraction)
 {
     return (fraction.CompareTo(number) * -1);
 }
コード例 #3
0
 /// <summary>
 /// Method for value comparison of fractions
 /// </summary>
 /// <returns>
 /// 0: if they are equal
 /// 1: if first > second
 /// -1: if second > first 
 /// </returns>
 public static int Compare(Fraction first, Fraction second)
 {
     if (ReferenceEquals(first, null))
         return ReferenceEquals(second, null) ? 0 : -1;
     return first.CompareTo(second);
 }