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 184 of 196
Uri.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 MoreDateTime.GetTypeCode() Method in C#
The DateTime.GetTypeCode() method in C# is used to return the TypeCode for the DateTime value type. The returned value is the enumerated constant TypeCode.DateTime. This method is inherited from the IConvertible interface and is primarily used in scenarios where you need to determine the type code of a DateTime object programmatically, such as in reflection or type conversion operations. Syntax Following is the syntax − public TypeCode GetTypeCode(); Return Value The method returns TypeCode.DateTime, which is an enumerated constant that represents the DateTime type. Using GetTypeCode() with Current DateTime The ...
Read MoreDateTime.IsDaylightSavingTime() Method in C#
The DateTime.IsDaylightSavingTime() method in C# determines whether a specific DateTime instance falls within the daylight saving time range for the current time zone. This method returns true if the date and time are within the DST period, and false otherwise. This method is particularly useful when working with time-sensitive applications that need to account for seasonal time changes in different regions. Syntax Following is the syntax for the DateTime.IsDaylightSavingTime() method − public bool IsDaylightSavingTime(); Return Value The method returns a bool value − true − if the DateTime instance is ...
Read MoreDateTime.IsLeapYear() Method in C#
The DateTime.IsLeapYear() method in C# is used to determine whether a specified year is a leap year. This static method returns true if the year is a leap year, and false otherwise. A leap year occurs every 4 years, with exceptions for century years that are not divisible by 400. Syntax Following is the syntax − public static bool IsLeapYear(int year); Parameters year − An integer representing the year to be checked. The year must be between 1 and 9999. Return Value Returns a bool value − ...
Read More