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 851 of 2109
Convert.FromBase64String(String) Method in C#
The Convert.FromBase64String(String) method in C# converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. This method is commonly used for decoding base64-encoded data back to its original byte representation. Syntax Following is the syntax − public static byte[] FromBase64String (string str); Parameters str − The string to convert. It must be a valid base64-encoded string. Return Value Returns a byte[] array containing the decoded binary data from the base64 string. Using FromBase64String for Byte Array Conversion The most common use ...
Read MoreConvert.ToBase64CharArray() Method in C#
The Convert.ToBase64CharArray() method in C# converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits. This method provides more control than the standard Convert.ToBase64String() by allowing you to specify input and output positions and work directly with character arrays. Syntax Following is the syntax − public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut); Parameters inArray − An input array of 8-bit unsigned integers (bytes). offsetIn − A position within the input array to start conversion. ...
Read MoreConvert.ToBase64String() Method in C#
The Convert.ToBase64String() method in C# is used to convert the value of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. This is commonly used for encoding binary data into a text format that can be safely transmitted or stored. Syntax Following is the syntax − public static string ToBase64String(byte[] inArray); Parameters inArray − An array of 8-bit unsigned integers to be converted to Base64 string. Return Value Returns a string representation of the contents of the byte array ...
Read MoreUInt16.Equals Method in C# with Examples
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 MoreUInt16.GetTypeCode() Method in C# with Examples
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 MoreDateTime.DaysInMonth() Method in C#
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 MoreConvert.ToBoolean(String, IFormatProvider) Method in C#
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 MoreChar.ConvertToUtf32(String, Int32) Method in C#
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 MoreDateTime.ToFileTimeUtc() Method in C#
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 MoreDateTime.ToLocalTime() Method in C#
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