BigDecimal bd1 = BigDecimal.Parse("345672345.23"); BigDecimal bd2 = BigDecimal.Parse("345672345.23"); int result = bd1.CompareTo(bd2); // result = 0 because bd1 is equal to bd2
BigDecimal bd1 = BigDecimal.Parse("345672345.23"); BigDecimal bd2 = BigDecimal.Parse("245672345.23"); int result = bd1.CompareTo(bd2); // result = 1 because bd1 is greater than bd2
BigDecimal bd1 = BigDecimal.Parse("345672345.23"); BigDecimal bd2 = BigDecimal.Parse("445672345.23"); int result = bd1.CompareTo(bd2); // result = -1 because bd1 is less than bd2The C# BigDecimal CompareTo method is part of the System.Numerics.BigInteger namespace.