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
Server Side Programming Articles
Page 859 of 2109
Math Class Fields with Examples in C#
The Math class in C# provides essential mathematical constants through predefined fields. The two most commonly used fields are Math.E (Euler's number) and Math.PI (pi), which represent fundamental mathematical constants used in various calculations. These fields are declared as public const double, making them accessible throughout your application without needing to instantiate the Math class. Math.E Field The Math.E field represents Euler's number, which is the natural logarithmic base. This constant is approximately equal to 2.718281828 and is frequently used in exponential and logarithmic calculations. Syntax public const double E = 2.71828182845905; ...
Read MoreUInt32.GetTypeCode() Method in C# with Examples
The UInt32.GetTypeCode() method in C# returns the TypeCode enumeration value for the UInt32 data type. This method is inherited from the IConvertible interface and is used to identify the underlying type of a value at runtime. The TypeCode enumeration provides a way to categorize the fundamental data types in .NET, making it useful for type checking and conversion operations. Syntax Following is the syntax for the UInt32.GetTypeCode() method − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.UInt32, which represents the enumerated constant for the 32-bit unsigned integer type. Using GetTypeCode() ...
Read MoreUInt32.ToString() Method in C# with Examples
The UInt32.ToString() method in C# is used to convert the numeric value of a UInt32 instance to its equivalent string representation. This method is particularly useful when you need to display unsigned 32-bit integer values as text or concatenate them with strings. The UInt32 type represents unsigned 32-bit integers with values ranging from 0 to 4, 294, 967, 295. The ToString() method provides several overloads to format the output according to different requirements. Syntax Following are the main syntax variations of the UInt32.ToString() method − public override string ToString(); public string ToString(string format); public string ...
Read MoreUri.EscapeDataString(String) Method in C#
The Uri.EscapeDataString() method in C# converts a string to its escaped representation by encoding characters that are not safe for use in URI data strings. This method is essential when you need to include user data or special characters in URL components like query parameters. Syntax Following is the syntax − public static string EscapeDataString(string stringToEscape); Parameters stringToEscape: A string that contains the data to be escaped. If the string is null, the method returns null. Return Value Returns a string that contains the escaped representation of stringToEscape. How It ...
Read MoreUri.FromHex() Method in C#
The Uri.FromHex() method in C# converts a single hexadecimal digit character to its corresponding decimal integer value. This static method is part of the Uri class and is commonly used when working with URL encoding and decoding operations. Syntax Following is the syntax − public static int FromHex(char digit); Parameters digit − A hexadecimal digit character (0-9, a-f, A-F) to convert to its decimal equivalent. Return Value Returns an int value representing the decimal equivalent of the hexadecimal digit. The method throws an ArgumentException if the character ...
Read MoreMath Class in C#
The Math class in C# provides static methods and constants for trigonometric, logarithmic, and other mathematical functions. This class is part of the System namespace and offers essential mathematical operations without requiring instantiation. The Math class includes important mathematical constants like Math.E and Math.PI, along with numerous methods for calculations such as power, trigonometric, and logarithmic functions. Math Constants Math.E The Math.E field represents the natural logarithmic base, specified by the mathematical constant e − public const double E = 2.71828182845905; using System; public class Demo { ...
Read MoreUInt16 Struct in C#
The UInt16 struct represents a 16-bit unsigned integer. The UInt16 value type represents unsigned integers with values ranging from 0 to 65, 535. The UInt16 struct provides several useful methods for comparison, equality checking, and string conversion operations. Let us explore the key methods with examples. UInt16.CompareTo() Method The UInt16.CompareTo() method compares the current instance to a specified object or UInt16 and returns an indication of their relative values. Syntax Following are the syntax overloads − public int CompareTo(object val); public int CompareTo(ushort val); Parameters val − An ...
Read MoreUInt32 Struct in C#
The UInt32 struct represents a 32-bit unsigned integer in C#. The UInt32 value type represents unsigned integers with values ranging from 0 to 4, 294, 967, 295 (2³² - 1). This struct provides several useful methods for comparison, equality checking, and value manipulation. Let us explore the key methods with practical examples. Syntax Following is the syntax for declaring a UInt32 variable − uint variableName = value; UInt32 variableName = value; The uint keyword is an alias for UInt32 and both can be used interchangeably. UInt32 Value Range ...
Read MoreDateTime.FromOADate() Method in C#
The DateTime.FromOADate() method in C# converts an OLE Automation Date value into a DateTime object. OLE Automation Date is a floating-point representation of dates and times where the integer part represents the number of days since December 30, 1899, and the fractional part represents the time of day. Syntax Following is the syntax for the DateTime.FromOADate() method − public static DateTime FromOADate(double d); Parameters The method takes a single parameter − d: A double-precision floating-point number representing the OLE Automation Date value. It can range from -657435.0 to 2958465.99999999. ...
Read MoreDateTime.GetDateTimeFormats() Method in C#
The DateTime.GetDateTimeFormats() method in C# converts a DateTime instance to all string representations supported by the standard date and time format specifiers. This method is useful for discovering all possible formatted outputs for a given DateTime value. Syntax Following are the two overloads of the method − public string[] GetDateTimeFormats() public string[] GetDateTimeFormats(char format) Parameters format − A standard date and time format character that specifies which format patterns to return (optional). Return Value Returns a string[] containing all possible string representations of the DateTime value using ...
Read More