' The example displays the following output: Compare first tuple with remaining two tuples.Ĭonsole.WriteLine(" = ", rate1.ToString())Įq.Equals(rate2, New RateComparer(Of String, Double, Double, Double, Double, Double, Double)()))Įq.Equals(rate3, New RateComparer(Of String, Double, Double, Double, Double, Double, Double)()))Įq.Equals(rate4, New RateComparer(Of String, Double, Double, Double, Double, Double, Double)())) Var rate3 = Tuple.Create("Unknown City", -.013934. Var rate2 = Tuple.Create("Unknown City", -.013934. Return Math.Round(((double) obj) * 1000).GetHashCode() Public new bool Equals(object x, object y) Public class RateComparer : IEqualit圜omparer The example uses this IEqualit圜omparer implementation to determine whether four Tuple objects that contain data on the rate of population change between 19 are equal. Otherwise, it simply calls the x parameter's Equals method. If the values that are passed to its IStructuralEquatable.Equals method are of type Single or Double, the method tests for equality by using only up to three fractional digits. The following example defines a RateComparer class that performs a custom test for equality. Equals(Object, IEqualit圜omparer) Examples
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |