Csharp Articles

Page 193 of 196

Uri.Equals(Object) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 161 Views

The Uri.Equals(Object) method in C# compares two Uri instances for equality. This method performs a case-sensitive comparison of the complete URI strings, including scheme, host, port, path, query, and fragment components. Syntax Following is the syntax − public override bool Equals(object comparand); Parameters comparand − The Uri instance or object to compare with the current instance. Can be null. Return Value Returns true if the specified object is a Uri instance equivalent to the current Uri instance; otherwise, false. If the comparand is null or not a Uri object, the method ...

Read More

Int64.CompareTo Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 279 Views

The Int64.CompareTo() method in C# is used to compare the current long instance with a specified object or Int64 value and returns an integer indicating their relative values. This method is essential for sorting operations and value comparisons. Syntax The Int64.CompareTo() method has two overloads − public int CompareTo(long value); public int CompareTo(object value); Parameters value − In the first overload, it's a long integer to compare. In the second overload, it's an object to compare, which must be null or an instance of Int64. Return Value The method ...

Read More

Decimal.Multiply() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 1K+ Views

The Decimal.Multiply() method in C# is used to multiply two specified decimal values and returns the result as a decimal. This method provides a safe way to perform decimal multiplication while maintaining precision and handling potential overflow conditions. Syntax Following is the syntax − public static decimal Multiply(decimal val1, decimal val2); Parameters val1 − The first decimal value (multiplicand). val2 − The second decimal value (multiplier). Return Value Returns a decimal value that represents the product of val1 and val2. Using Decimal.Multiply() for Basic ...

Read More

Decimal.Negate() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 770 Views

The Decimal.Negate() method in C# is used to return the result of multiplying the specified decimal value by negative one. This method effectively changes the sign of a decimal number − positive numbers become negative and negative numbers become positive. Syntax Following is the syntax − public static decimal Negate(decimal val); Parameters val − The decimal value to negate. Return Value Returns a decimal number that is equal to val multiplied by negative one (-1). If val is positive, the result is negative. If val is negative, the result ...

Read More

Decimal.Remainder() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 319 Views

The Decimal.Remainder() method in C# is used to calculate the remainder after dividing two Decimal values. This method performs the same operation as the modulus operator (%) but is specifically designed for decimal precision calculations. Syntax Following is the syntax − public static decimal Remainder(decimal val1, decimal val2); Parameters val1 − The dividend (the number to be divided). val2 − The divisor (the number by which to divide). Return Value Returns a decimal value representing the remainder after dividing val1 by val2. Division Operation: ...

Read More

Decimal.Round() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 9K+ Views

The Decimal.Round() method in C# is used to round a decimal value to the nearest integer or to a specified number of decimal places. This method provides several overloads to handle different rounding scenarios and precision requirements. Syntax The Decimal.Round() method has four main overloads − public static decimal Round(decimal d); public static decimal Round(decimal d, int decimals); public static decimal Round(decimal d, MidpointRounding mode); public static decimal Round(decimal d, int decimals, MidpointRounding mode); Parameters d − The decimal number to be rounded. decimals − The number of decimal ...

Read More

Decimal.Subtract() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 652 Views

The Decimal.Subtract() method in C# is used to subtract two specified decimal values and returns the result. This static method provides a way to perform decimal subtraction with high precision, making it ideal for financial and monetary calculations. Syntax Following is the syntax − public static decimal Subtract(decimal val1, decimal val2); Parameters val1 − The minuend (the number from which another number is to be subtracted). val2 − The subtrahend (the number that is to be subtracted). Return Value Returns a decimal value that represents ...

Read More

Int64.GetTypeCode Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 180 Views

The Int64.GetTypeCode() method in C# is used to return the TypeCode for value type Int64. This method is inherited from the IConvertible interface and returns TypeCode.Int64 for all 64-bit signed integer values. Syntax Following is the syntax − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.Int64, which is the enumerated constant representing the Int64 type. Using GetTypeCode() with Different Values Example Let us see an example to implement the Int64.GetTypeCode() method − using System; public class Demo { public static void Main() { ...

Read More

MathF.Abs() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 261 Views

The MathF.Abs() method in C# is used to return the absolute value of a float number. The absolute value represents the non-negative value of a number without regard to its sign. For example, the absolute value of both -5.5f and 5.5f is 5.5f. This method is part of the System namespace and is specifically designed for float operations, providing better performance than the generic Math.Abs() method when working with single-precision floating-point numbers. Syntax Following is the syntax for the MathF.Abs() method − public static float Abs(float val); Parameters val − A ...

Read More

Char.IsPunctuation() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 662 Views

The Char.IsPunctuation() method in C# determines whether a specified Unicode character is categorized as a punctuation mark. This method is useful for text processing, input validation, and character analysis tasks. Syntax Following is the syntax − public static bool IsPunctuation(char ch); Parameters ch − The Unicode character to evaluate. Return Value Returns true if the character is a punctuation mark; otherwise, false. Character Classification Punctuation ! ? . , ; : " ' ...

Read More
Showing 1921–1930 of 1,951 articles
Advertisements