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 175 of 196
Dictionary.Count Property in C#
The Dictionary.Count property in C# gets the number of key/value pairs contained in the Dictionary. This property is read-only and provides an efficient way to determine the size of your dictionary collection. Syntax public int Count { get; } Return Value The property returns an int representing the total number of key/value pairs in the dictionary. The count is automatically updated when items are added or removed. Using Dictionary.Count Property Basic Usage Example The following example demonstrates how to use the Count property to track dictionary size − using ...
Read MoreCharEnumerator.MoveNext() Method in C#
The CharEnumerator.MoveNext() method in C# advances the internal index of the current CharEnumerator object to the next character of the enumerated string. It returns true if the enumerator successfully moved to the next character, or false if it has passed the end of the string. Syntax public bool MoveNext(); Return Value The method returns a bool value − true − if the enumerator was successfully advanced to the next character false − if the enumerator has passed the end of the string ...
Read MoreCharEnumerator.Reset() Method in C#
The CharEnumerator.Reset() method in C# initializes the enumerator's position to logically before the first character of the enumerated string. This method is useful when you need to restart enumeration from the beginning after having already iterated through the string. Syntax Following is the syntax for the CharEnumerator.Reset() method − public void Reset(); Parameters This method takes no parameters. Return Value This method does not return any value (void). How It Works When you call Reset(), the enumerator's internal position is moved to before the first character. After calling Reset(), ...
Read MoreMath.Tanh() Method in C#
The Math.Tanh() method in C# returns the hyperbolic tangent of a specified angle. The hyperbolic tangent function is commonly used in mathematical calculations, especially in calculus and engineering applications. Unlike the regular tangent function which deals with circular trigonometry, the hyperbolic tangent operates on hyperbolic angles. Syntax Following is the syntax for the Math.Tanh() method − public static double Tanh(double value); Parameters The method accepts the following parameter − value − A double representing the angle in radians for which to calculate the hyperbolic tangent. Return Value ...
Read MoreMath.Truncate() Method in C#
The Math.Truncate() method in C# is used to remove the fractional part of a number and return only the integral part. It works with both decimal and double data types, effectively cutting off all digits after the decimal point without rounding. Syntax The Math.Truncate() method has two overloads − public static decimal Truncate(decimal d) public static double Truncate(double d) Parameters d − A decimal or double number to truncate. Return Value Returns the integral part of the specified number. The return type matches the input parameter type (decimal returns ...
Read MoreCharEnumerator.ToString() Method in C#
The CharEnumerator.ToString() method in C# returns a string representation of the current CharEnumerator object. This method is inherited from the Object class and provides basic type information about the enumerator instance. Syntax Following is the syntax − public override string ToString(); Return Value The method returns a string that represents the current object. For CharEnumerator, this typically returns the fully qualified type name "System.CharEnumerator". Using CharEnumerator.ToString() Method Example Let us see an example to implement the CharEnumerator.ToString() method − using System; public class Demo { ...
Read MoreConvert.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.CompareTo() Method in C# with Examples
The UInt16.CompareTo() method in C# is used to compare the current instance to a specified object or UInt16 and returns an indication of their relative values. This method is essential for sorting operations and conditional comparisons involving unsigned 16-bit integers. Syntax The UInt16.CompareTo() method has two overloads − public int CompareTo(object val); public int CompareTo(ushort val); Parameters val − In the first overload, it is an object to compare. In the second overload, it is an unsigned 16-bit integer to compare. Return Value The method returns an ...
Read More