Csharp Articles

Page 177 of 196

Convert.ToDateTime(String, IFormatProvider) Method in C#

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

The Convert.ToDateTime(String, IFormatProvider) method in C# converts a string representation of a date and time to an equivalent DateTime object, using the specified culture-specific formatting information. This method is particularly useful when working with date strings from different cultures or regions, as it allows you to specify how the date should be interpreted based on cultural formatting conventions. Syntax Following is the syntax − public static DateTime ToDateTime(string value, IFormatProvider provider); Parameters value − A string that contains a date and time to convert. provider − An object ...

Read More

Convert.ToDecimal(String, IFormatProvider) Method in C#

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

The Convert.ToDecimal(String, IFormatProvider) method in C# converts the specified string representation of a number to an equivalent decimal number, using the specified culture-specific formatting information. This overload is particularly useful when dealing with different number formats across various cultures and locales. Syntax Following is the syntax − public static decimal ToDecimal(string value, IFormatProvider provider); Parameters value − A string that contains a number to convert. provider − An object that supplies culture-specific formatting information. If null, the current thread culture is used. Return Value Returns a decimal number that ...

Read More

Decimal.CompareTo() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 195 Views

The Decimal.CompareTo() method in C# is used to compare the current decimal instance with another decimal value or object. It returns an integer that indicates whether the current instance is less than, equal to, or greater than the comparison value. Syntax The Decimal.CompareTo() method has two overloads − public int CompareTo(decimal value); public int CompareTo(object value); Parameters value − A decimal number or object to compare with the current instance. Return Value The method returns an int value indicating the comparison result − Less than zero − ...

Read More

Decimal.Divide() Method in C#

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

The Decimal.Divide() method in C# is used to divide two specified Decimal values and return the quotient. This static method provides precise division operations for financial and monetary calculations where accuracy is critical. Syntax Following is the syntax − public static decimal Divide(decimal val1, decimal val2); Parameters val1 − The dividend (the number to be divided). val2 − The divisor (the number by which val1 is divided). Return Value Returns a decimal value representing the result of dividing val1 by val2. The method throws a ...

Read More

Decimal.Floor() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 591 Views

The Decimal.Floor() method in C# rounds a specified decimal number down to the nearest integer toward negative infinity. This means it always rounds down, even for negative numbers. Syntax Following is the syntax − public static decimal Floor(decimal val); Parameters val − The decimal value to round down to the nearest integer. Return Value Returns a decimal value representing the largest integer less than or equal to the specified decimal number. Decimal.Floor() Behavior Number Line ...

Read More

Type.GetTypeFromHandle() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 226 Views

The Type.GetTypeFromHandle() method in C# is used to get the Type object referenced by the specified RuntimeTypeHandle. This method is particularly useful when working with type handles obtained from reflection operations or when you need to convert a type handle back to its corresponding Type object. Syntax Following is the syntax − public static Type GetTypeFromHandle(RuntimeTypeHandle handle); Parameters The method accepts the following parameter − handle − A RuntimeTypeHandle that refers to a specific type. Return Value Returns a Type object that represents the type referenced ...

Read More

Type.GetTypeHandle() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 132 Views

The Type.GetTypeHandle() method in C# is used to get the runtime type handle for a specified object. A RuntimeTypeHandle provides a lightweight way to reference a type without holding a direct reference to the Type object itself, which is useful in performance-critical scenarios and interop operations. Syntax Following is the syntax for the Type.GetTypeHandle() method − public static RuntimeTypeHandle GetTypeHandle(object o) Parameters o − The object for which to get the type handle. Return Value Returns a RuntimeTypeHandle structure that represents the type of the specified object. Using ...

Read More

Type.GetFields() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 370 Views

The Type.GetFields() method in C# is used to retrieve the fields of the current Type using reflection. This method returns an array of FieldInfo objects representing the fields that match the specified binding criteria. Fields are data members of a class that store values. The GetFields() method allows you to examine both public and non-public fields at runtime, making it useful for inspection, debugging, and dynamic programming scenarios. Syntax Following is the syntax for the parameterless overload − public System.Reflection.FieldInfo[] GetFields(); Following is the syntax for the overload with binding flags − ...

Read More

DateTime.Add() Method in C#

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

The DateTime.Add() method in C# is used to return a new DateTime that adds the value of the specified TimeSpan to the value of this instance. This method allows you to add or subtract time intervals including days, hours, minutes, seconds, and milliseconds. Syntax Following is the syntax − public DateTime Add(TimeSpan value); Parameters value − A positive or negative TimeSpan that represents the time interval to add to the current DateTime instance. Return Value Returns a new DateTime object whose value is the sum of the ...

Read More

DateTime.AddDays() Method in C#

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

The DateTime.AddDays() method in C# is used to add the specified number of days to the value of this instance. This method returns a new DateTime object without modifying the original instance, as DateTime is immutable. Syntax Following is the syntax − public DateTime AddDays(double days); Parameters days − A number of whole and fractional days. The value parameter can be negative or positive. Return Value This method returns a new DateTime object whose value is the sum of the date and time represented by this instance and the ...

Read More
Showing 1761–1770 of 1,951 articles
« Prev 1 175 176 177 178 179 196 Next »
Advertisements