Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by AmitDiwan
Page 220 of 840
BitConverter.ToBoolean() Method in C#
The BitConverter.ToBoolean() method in C# returns a Boolean value converted from the byte at a specified position in a byte array. This method reads a single byte and returns true if the byte is non-zero, or false if the byte is zero. Syntax Following is the syntax − public static bool ToBoolean(byte[] value, int startIndex); Parameters value − An array of bytes. startIndex − The starting position within the byte array. Return Value Returns true if the byte at startIndex in the array is non-zero; otherwise, false. ...
Read MoreInt64.CompareTo Method in C# with Examples
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 MoreBoolean.CompareTo(Boolean) Method in C#
The Boolean.CompareTo(Boolean) method in C# is used to compare the current Boolean instance with another Boolean object and returns an integer indicating their relative values. Syntax Following is the syntax − public int CompareTo(bool value); Parameters value − A Boolean object to compare with the current instance. Return Value The method returns an integer value − -1 − if the current instance is false and value is true 0 − if the current instance and value are equal 1 − if the current instance ...
Read MoreMath.Exp() Method in C#
The Math.Exp() method in C# returns e (Euler's number, approximately 2.718) raised to the specified power. This method is commonly used in mathematical calculations involving exponential functions, growth calculations, and scientific computations. Syntax Following is the syntax for the Math.Exp() method − public static double Exp(double d) Parameters d − A double-precision floating-point number representing the power to which e is raised. Return Value Returns a double value representing ed. Special cases include: If d equals Double.NaN, the method returns NaN. If ...
Read MoreMath.Floor() Method in C#
The Math.Floor() method in C# returns the largest integral value that is less than or equal to the specified number. It rounds down to the nearest integer, which is particularly important to understand when working with negative numbers. Syntax The Math.Floor() method has two overloads − public static decimal Floor(decimal val); public static double Floor(double val); Parameters val − A decimal or double number to be rounded down to the nearest integer. Return Value Returns the largest integer less than or equal to val. The return type ...
Read MoreBoolean.CompareTo(Object) Method in C#
The Boolean.CompareTo(Object) method in C# compares the current Boolean instance to a specified object and returns an integer that indicates their relationship to one another. This method is useful for sorting Boolean values or implementing custom comparison logic. Syntax Following is the syntax − public int CompareTo(object obj); Where obj is an object to compare to this instance, or null. Return Value The method returns an integer value indicating the relationship between the current instance and the specified object − Less than zero: This instance is false and obj is ...
Read MoreDecimal.Multiply() Method in C#
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 MoreDecimal.Negate() Method in C#
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 MoreByte.Equals(Object) Method in C#
The Byte.Equals(Object) method in C# returns a value indicating whether this instance is equal to a specified object. This method compares the current byte instance with another object and returns true if they are equal, false otherwise. Syntax Following is the syntax − public override bool Equals (object obj); Parameters obj − An object to compare with this instance, or null. Return Value Returns true if obj is a byte instance and equals the value of this instance; otherwise, false. Example Let us now see an example ...
Read MoreDecimal.Remainder() Method in C#
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