Server Side Programming Articles

Page 856 of 2109

Decimal.ToSingle() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 201 Views

The Decimal.ToSingle() method in C# is used to convert the value of the specified decimal to the equivalent single-precision floating-point number (float). This method is useful when you need to convert high-precision decimal values to float for mathematical operations or when interfacing with APIs that require float parameters. Syntax Following is the syntax − public static float ToSingle(decimal val); Parameters val − The decimal number to convert to a single-precision floating-point number. Return Value Returns a single-precision floating-point number (float) that is equivalent to the specified decimal value. Using Decimal.ToSingle() ...

Read More

Char.Parse(String) Method in C#

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

The Char.Parse(String) method in C# is used to convert the value of the specified string to its equivalent Unicode character. This method is particularly useful when you need to extract a single character from a string representation. Syntax Following is the syntax − public static char Parse(string s); Parameters s − A string that contains a single character, or null. Return Value Returns a Unicode character that is equivalent to the sole character in s. Examples Example 1: Parsing a Letter Character The following ...

Read More

Char.ToLowerInvariant(Char) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 285 Views

The Char.ToLowerInvariant() method in C# is used to convert a Unicode character to its lowercase equivalent using the casing rules of the invariant culture. This method ensures consistent case conversion regardless of the current system culture, making it ideal for culture-independent operations. Syntax Following is the syntax − public static char ToLowerInvariant(char ch); Parameters ch − The Unicode character to convert to lowercase. Return Value Returns the lowercase equivalent of the specified character, or the same character if it has no lowercase equivalent or is already lowercase. ...

Read More

Char.ToString() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 217 Views

The Char.ToString() method in C# is used to convert a character to its equivalent string representation. This method is particularly useful when you need to convert a single character into a string for string operations or concatenation. Syntax Following is the syntax for the Char.ToString() method − public override string ToString(); Return Value The method returns a string object containing the character value converted to its string representation. Using Char.ToString() Method Example 1 - Converting Lowercase Character Let us see an example to convert a lowercase character to its string ...

Read More

Math.BigMul() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 305 Views

The Math.BigMul() method in C# is used to calculate the full product of two 32-bit integers. This method is particularly useful when multiplying large integers that might produce a result exceeding the range of a 32-bit integer, as it returns a 64-bit long value to accommodate the full product. Syntax Following is the syntax − public static long BigMul(int val1, int val2); Parameters val1: The first 32-bit integer to multiply val2: The second 32-bit integer to multiply Return Value Returns a long (64-bit integer) containing ...

Read More

Decimal.ToUInt16() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 106 Views

The Decimal.ToUInt16() method in C# is used to convert the value of the specified Decimal to the equivalent 16-bit unsigned integer (ushort). This method performs a narrowing conversion, truncating any fractional part. Syntax Following is the syntax − public static ushort ToUInt16(decimal val); Parameters val − The decimal number to convert to a 16-bit unsigned integer. Return Value Returns a ushort value that represents the converted decimal. The fractional part is truncated (not rounded). How It Works The method truncates the decimal value to the ...

Read More

DateTime.SpecifyKind() Method in C#

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

The DateTime.SpecifyKind() method in C# is used to create a new DateTime object that has the same number of ticks as the specified DateTime but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value. This method is particularly useful when you have a DateTime value but need to explicitly specify its time zone context without changing the actual time value. The original DateTime remains unchanged − a new instance is returned with the specified Kind property. Syntax Following is the syntax for the DateTime.SpecifyKind() method − ...

Read More

DateTimeOffset.CompareTo() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 157 Views

The DateTimeOffset.CompareTo() method in C# compares the current DateTimeOffset object to a specified DateTimeOffset object and indicates whether the current object is earlier than, the same as, or later than the second DateTimeOffset object. It returns an integer value based on the comparison result − < 0 − If this object is earlier than the specified value 0 − If this object is the same as the specified value > 0 − If this object is later than the specified value Syntax Following is the syntax − public int CompareTo(DateTimeOffset value); ...

Read More

How to create 2-tuple or pair tuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 359 Views

The Tuple class in C# represents a 2-tuple, also known as a pair. A tuple is a data structure that contains a sequence of elements of different types. The 2-tuple holds exactly two values that can be accessed using Item1 and Item2 properties. 2-tuples are useful when you need to return two values from a method or group two related values together without creating a separate class. Syntax Following is the syntax for creating a 2-tuple − Tuple tuple = new Tuple(value1, value2); Accessing tuple elements − var firstValue = tuple.Item1; ...

Read More

DateTime.Subtract() Method in C#

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

The DateTime.Subtract() method in C# is used to subtract either a DateTime or a TimeSpan from the current DateTime instance. This method has two overloads: one subtracts a DateTime and returns the time difference as a TimeSpan, while the other subtracts a TimeSpan and returns a new DateTime. Syntax Following are the two overloads of the DateTime.Subtract() method − public TimeSpan Subtract(DateTime value); public DateTime Subtract(TimeSpan value); Parameters value − Either a DateTime instance to subtract from the current date, or a TimeSpan representing the duration to subtract. ...

Read More
Showing 8551–8560 of 21,090 articles
« Prev 1 854 855 856 857 858 2109 Next »
Advertisements