Csharp Articles

Page 176 of 196

UInt16.Equals Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 190 Views

The UInt16.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt16. This method provides two overloads: one for comparing with any object, and another specifically for comparing with another ushort value. Syntax Following are the two overloaded syntax forms − public override bool Equals (object ob); public bool Equals (ushort ob); Parameters ob (first overload) − An object to compare to this instance. ob (second overload) − The 16-bit unsigned integer to compare to this instance. Return Value Returns true ...

Read More

UInt16.GetTypeCode() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 155 Views

The UInt16.GetTypeCode() method in C# is used to return the TypeCode for value type UInt16. This method is part of the IConvertible interface and provides a way to identify the underlying data type at runtime. The TypeCode enumeration represents different data types in .NET, and for all UInt16 values, this method always returns TypeCode.UInt16. Syntax Following is the syntax for the UInt16.GetTypeCode() method − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.UInt16, which is the enumerated constant for the UInt16 data type. Using GetTypeCode() with Different UInt16 Values Example ...

Read More

DateTime.DaysInMonth() Method in C#

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

The DateTime.DaysInMonth() method in C# returns the number of days in the specified month and year. This static method is particularly useful for calendar calculations and date validations, automatically handling leap years and different month lengths. Syntax Following is the syntax for the DateTime.DaysInMonth() method − public static int DaysInMonth(int year, int month); Parameters year − An integer representing the year (1 to 9999). month − An integer representing the month (1 to 12). Return Value Returns an int representing the number of days in ...

Read More

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 498 Views

The Convert.ToBoolean(String, IFormatProvider) method in C# converts a string representation to an equivalent Boolean value using culture-specific formatting information. This method accepts only specific string values: "True", "False", or their equivalents in different cultures. Syntax Following is the syntax − public static bool ToBoolean(string value, IFormatProvider provider); Parameters value − A string containing the value of either TrueString or FalseString. provider − An object that supplies culture-specific formatting information (this parameter is ignored for Boolean conversions). Return Value Returns true if value equals TrueString, or false if value equals ...

Read More

Char.ConvertToUtf32(String, Int32) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 358 Views

The Char.ConvertToUtf32(String, Int32) method in C# is used to convert the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point. This method is particularly useful when working with Unicode characters that may be represented as surrogate pairs in UTF-16 encoding. Syntax Following is the syntax − public static int ConvertToUtf32(string s, int index); Parameters s − The string that contains a character or surrogate pair. index − The index position of the character or surrogate pair in ...

Read More

DateTime.ToFileTimeUtc() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 283 Views

The DateTime.ToFileTimeUtc() method in C# converts the value of the current DateTime object to a Windows file time. A Windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D. (UTC). This method is particularly useful when working with file systems, as Windows uses this format internally to store file timestamps. The method automatically converts the DateTime to UTC before performing the conversion. Syntax Following is the syntax − public long ToFileTimeUtc(); Return Value This method returns a long ...

Read More

DateTime.ToLocalTime() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 494 Views

The DateTime.ToLocalTime() method in C# converts a DateTime object to the local time zone of the current system. This method is particularly useful when working with UTC times or when you need to display times in the user's local time zone. Syntax Following is the syntax for the ToLocalTime() method − public DateTime ToLocalTime(); Return Value This method returns a new DateTime object that represents the local time equivalent of the current DateTime instance. If the original DateTime has Kind property set to DateTimeKind.Local, it returns the same value unchanged. How It ...

Read More

DateTime.ToLongDateString() Method in C#

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

The DateTime.ToLongDateString() method in C# converts a DateTime object to its equivalent long date string representation. This method returns a human-readable date format that includes the day of the week, month name, day, and year, formatted according to the current culture settings. Syntax Following is the syntax − public string ToLongDateString(); Return Value This method returns a string that represents the long date format of the DateTime object. The format follows the current culture's long date pattern, typically in the form "Day, Month Date, Year". Using ToLongDateString() with Specific DateTime The ...

Read More

DateTime.ToLongTimeString() Method in C#

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

The DateTime.ToLongTimeString() method in C# is used to convert the value of the current DateTime object to its equivalent long time string representation. This method formats the time portion of a DateTime object according to the current culture's long time format pattern. Syntax Following is the syntax − public string ToLongTimeString(); Return Value Returns a string that contains the long time string representation of the current DateTime object, formatted according to the current culture's long time pattern. Using ToLongTimeString() with Current DateTime The method uses the current system culture to determine ...

Read More

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

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

The Convert.ToChar(String, IFormatProvider) method in C# converts the first character of a specified string to a Unicode character. This method uses culture-specific formatting information, though the IFormatProvider parameter is ignored for string-to-char conversion since character conversion doesn't depend on culture. Syntax Following is the syntax − public static char ToChar(string val, IFormatProvider provider); Parameters val − A string of length 1 or null. provider − An object that supplies culture-specific formatting information. This parameter is ignored for string-to-char conversion. Return Value Returns a Unicode character ...

Read More
Showing 1751–1760 of 1,951 articles
« Prev 1 174 175 176 177 178 196 Next »
Advertisements