Csharp Articles

Page 174 of 196

Dictionary.Clear Method in C#

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

The Dictionary.Clear() method in C# removes all key/value pairs from the Dictionary. This method is useful when you need to empty a dictionary completely while keeping the dictionary object itself for future use. Syntax public void Clear(); Parameters The Clear() method takes no parameters. Return Value The Clear() method does not return any value. It has a void return type. Dictionary.Clear() Operation Before Clear() Key1: Value1 Key2: Value2 Key3: Value3 ...

Read More

Char.IsWhiteSpace() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 578 Views

The Char.IsWhiteSpace() method in C# is used to determine whether a specified Unicode character is classified as white space. This includes spaces, tabs, line feeds, carriage returns, and other Unicode whitespace characters. Syntax Following is the syntax for the Char.IsWhiteSpace() method − public static bool IsWhiteSpace(char ch); Parameters ch − The Unicode character to evaluate. Return Value Returns true if the character is a whitespace character; otherwise, false. Char.IsWhiteSpace() Method Input char ch ...

Read More

Math.Exp() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 357 Views

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 More

Math.Floor() Method in C#

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

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 More

Type.Equals() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 941 Views

The Type.Equals() method in C# determines if the underlying system type of the current Type is the same as the underlying system type of the specified Object or Type. This method is essential for type comparison operations in reflection scenarios. Syntax The Type.Equals() method has two overloads − public virtual bool Equals(Type o); public override bool Equals(object o); Parameters o − The object or Type whose underlying system type is to be compared with the underlying system type of the current Type. Return Value Returns true if ...

Read More

Type.GetArrayRank() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 144 Views

The Type.GetArrayRank() method in C# returns the number of dimensions in an array type. This method is useful when working with multidimensional arrays and you need to determine how many dimensions the array has at runtime. The method works only with array types. If called on a non-array type, it throws an ArgumentException. Syntax Following is the syntax for the GetArrayRank() method − public virtual int GetArrayRank(); Return Value The method returns an int representing the number of dimensions in the array. For example, a single-dimensional array returns 1, a two-dimensional array ...

Read More

Math.IEEERemainder() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 118 Views

The Math.IEEERemainder() method in C# returns the remainder resulting from the division of a specified number by another specified number. Unlike the modulus operator (%), this method follows the IEEE 754 standard for floating-point arithmetic, which can produce different results in certain cases. The IEEE remainder is calculated as dividend - (divisor * Math.Round(dividend / divisor)), where the division result is rounded to the nearest even integer when exactly halfway between two integers. Syntax public static double IEEERemainder(double dividend, double divisor); Parameters dividend − A double-precision floating-point number (the number to be ...

Read More

Math.Log() Method in C#

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

The Math.Log() method in C# is used to return the logarithm of a specified number. This method provides two overloads: one for calculating the natural logarithm (base e) and another for calculating logarithm with a specified base. Syntax Following are the two overloads of the Math.Log() method − public static double Log(double num) public static double Log(double num, double newBase) Parameters num − The number whose logarithm is to be calculated (must be positive for real results). newBase − The base of the logarithm (must be positive and not equal to 1). ...

Read More

Math.Log10() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 447 Views

The Math.Log10() method in C# calculates the base-10 logarithm of a specified number. This method is particularly useful in mathematical calculations, scientific computations, and when working with exponential data that needs to be converted to a logarithmic scale. Syntax Following is the syntax for the Math.Log10() method − public static double Log10(double d); Parameters d − A double-precision floating-point number whose base-10 logarithm is to be found. Return Value The Log10() method returns different values based on the input parameter − Input Parameter (d) Return Value ...

Read More

Char.TryParse() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 520 Views

The Char.TryParse() method in C# is used to convert a string representation to its equivalent Unicode character. This method returns true if the conversion succeeds, or false if it fails, making it a safe alternative to Char.Parse() which throws exceptions on invalid input. The method only succeeds if the input string contains exactly one character. Multi-character strings, empty strings, or null values will cause the method to return false. Syntax Following is the syntax for the Char.TryParse() method − public static bool TryParse(string str, out char result); Parameters str − ...

Read More
Showing 1731–1740 of 1,951 articles
« Prev 1 172 173 174 175 176 196 Next »
Advertisements