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
Csharp Articles
Page 179 of 196
Convert.ToByte(String, IFormatProvider) Method in C#
The Convert.ToByte(String, IFormatProvider) method in C# converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information. This method is particularly useful when working with string data from different cultures that may use different number formats, such as different decimal separators or thousand separators. Syntax Following is the syntax − public static byte ToByte(string value, IFormatProvider provider); Parameters value − A string that contains the number to convert. The value must be between 0 and 255. provider − An object ...
Read MoreChar.ConvertFromUtf32(Int32) Method in C#
The Char.ConvertFromUtf32(Int32) method in C# converts a specified Unicode code point into a UTF-16 encoded string. This method is particularly useful when working with Unicode characters that may be represented as numeric code points and need to be converted to their corresponding string representation. Syntax Following is the syntax − public static string ConvertFromUtf32(int utf32); Parameters utf32: A 21-bit Unicode code point representing a valid Unicode character. The valid range is from 0x000000 to 0x10FFFF, excluding the surrogate pair range (0xD800 to 0xDFFF). Return Value Returns a string object consisting of ...
Read MoreMath.Min() Method in C#
The Math.Min() method in C# is used to return the smaller of two specified numbers. This method is overloaded to work with various numeric data types including byte, decimal, double, float, int, long, sbyte, short, uint, ulong, and ushort. Syntax Following are the most commonly used overloads − public static int Min(int val1, int val2); public static double Min(double val1, double val2); public static decimal Min(decimal val1, decimal val2); public static float Min(float val1, float val2); public static long Min(long val1, long val2); public static byte Min(byte val1, byte val2); public static short Min(short val1, short ...
Read MoreMath.Pow() Method in C#
The Math.Pow() method in C# is used to compute a number raised to the power of another number. It returns the result as a double value and can handle both positive and negative bases and exponents. Syntax Following is the syntax − public static double Pow(double val1, double val2) Parameters val1 − A double-precision floating-point number to be raised to a power (the base). val2 − A double-precision floating-point number that specifies the power (the exponent). Return Value Returns a double representing val1 raised to ...
Read MoreDateTime.AddYears() Method in C#
The DateTime.AddYears() method in C# adds a specified number of years to a DateTime instance and returns a new DateTime object. This method is particularly useful for calculating future or past dates, handling anniversaries, or working with year-based intervals. Syntax Following is the syntax for the AddYears() method − public DateTime AddYears(int value); Parameters The method accepts a single parameter − value − An integer representing the number of years to add. Use positive values to add years and negative values to subtract years. Return Value Returns a ...
Read MoreMath.Sqrt() Method in C#
The Math.Sqrt() method in C# is used to compute the square root of a specified number. This static method is part of the System.Math class and returns a double value representing the positive square root of the input. Syntax Following is the syntax − public static double Sqrt(double val); Parameters val − A double-precision floating-point number for which to calculate the square root. Must be greater than or equal to zero for a valid numeric result. Return Value The method returns a double value with the following behavior − ...
Read MoreType.GetElementType() Method in C#
The Type.GetElementType() method in C# is used to return the Type of the object encompassed or referred to by the current array, pointer, or reference type. This method is particularly useful when working with collection types to discover what type of elements they contain. Syntax Following is the syntax − public abstract Type GetElementType(); Return Value Returns a Type object representing the element type of the current array, pointer, or reference type. If the current Type is not an array, pointer, or reference type, the method returns null. Using GetElementType() with Arrays ...
Read MoreType.GetEnumName() Method in C#
The Type.GetEnumName() method in C# returns the name of the constant that has the specified value for the current enumeration type. This method is useful when you need to convert an enum value back to its string representation. Syntax Following is the syntax − public virtual string GetEnumName(object value); Parameters value − An object whose value is a constant in the current enumeration type. Return Value Returns a string containing the name of the enumerated constant that has the specified value, or null if no such constant is found. ...
Read MoreDateTimeOffset.FromFileTime() Method in C#
The DateTimeOffset.FromFileTime() method in C# converts a Windows file time value (in ticks) to an equivalent DateTimeOffset representing the local time. This method is useful when working with file timestamps or Windows-specific time representations. Syntax Following is the syntax for the DateTimeOffset.FromFileTime() method − public static DateTimeOffset FromFileTime(long fileTime); Parameters fileTime: A Windows file time expressed in ticks. This represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC). Return Value Returns a DateTimeOffset object that represents the date and ...
Read MoreDateTimeOffset.FromUnixTimeMilliseconds() Method in C#
The DateTimeOffset.FromUnixTimeMilliseconds() method in C# is used to convert a Unix timestamp expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z (Unix epoch) to a DateTimeOffset value. Unix timestamps are commonly used in web APIs, databases, and cross-platform applications as a standard way to represent time. This method provides an easy conversion from the Unix millisecond format to C#'s DateTimeOffset structure. Syntax Following is the syntax for the method − public static DateTimeOffset FromUnixTimeMilliseconds(long milliseconds); Parameters milliseconds − A long value representing the number of milliseconds that have elapsed ...
Read More