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
Articles by AmitDiwan
Page 209 of 840
Queue.CopyTo() Method in C#
The Queue.CopyTo() method in C# is used to copy the Queue elements to an existing one-dimensional Array, starting at the specified array index. This method is particularly useful when you need to transfer queue elements into an array while preserving the FIFO (First In, First Out) order. Syntax Following is the syntax for the Queue.CopyTo() method − public virtual void CopyTo(Array arr, int index); Parameters arr − The one-dimensional Array that is the destination of the elements copied from Queue. The Array must have zero-based indexing. index − The ...
Read MoreQueue.Count Property in C#
The Queue.Count property in C# is a read-only property that returns the number of elements currently stored in the Queue collection. This property provides an efficient way to check the size of the queue without needing to iterate through all elements. Syntax The syntax for the Queue.Count property is as follows − public virtual int Count { get; } Return Value The Count property returns an int value representing the total number of elements in the Queue. If the queue is empty, it returns 0. Using Count with Queue Operations The ...
Read MoreQueue.Dequeue Method in C#
The Queue.Dequeue() method in C# is used to remove and return the object at the beginning of the Queue. This method follows the FIFO (First In, First Out) principle, where the first element added to the queue is the first one to be removed. Syntax Following is the syntax for the Dequeue() method − public T Dequeue(); Return Value The method returns the object that is removed from the beginning of the Queue. If the queue is empty, it throws an InvalidOperationException. Queue.Dequeue() Operation ...
Read MoreRemove all the strings from the StringCollection in C#
The StringCollection class in C# provides the Clear() method to remove all strings from the collection at once. This method is part of the System.Collections.Specialized namespace and is useful when you need to empty the entire collection efficiently. Syntax Following is the syntax for the Clear() method − stringCollection.Clear(); Parameters The Clear() method does not take any parameters. Return Value The Clear() method does not return any value. It has a return type of void. StringCollection.Clear() Process Before Clear() ...
Read MoreC# String.IsNormalized Method
The String.IsNormalized() method in C# is used to indicate whether this string is in a particular Unicode normalization form. Unicode normalization ensures that text with the same meaning has a consistent binary representation, which is important for string comparison and text processing. Syntax The syntax is as follows − public bool IsNormalized(); public bool IsNormalized(System.Text.NormalizationForm normalizationForm); Parameters normalizationForm − A System.Text.NormalizationForm enumeration value that specifies the Unicode normalization form to check against. The possible values are: FormC − Canonical Decomposition followed by Canonical Composition FormD − Canonical Decomposition FormKC − Compatibility ...
Read MoreGets or sets the value at the specified key in StringDictionary in C#
The StringDictionary class in C# provides an indexer property that allows you to get or set values using a key-based approach. This indexer uses the syntax dictionary[key] to access or modify values at the specified key. Syntax Following is the syntax for getting or setting values using the indexer − // Getting a value string value = stringDictionary[key]; // Setting a value stringDictionary[key] = newValue; Parameters key − A string that represents the key to locate in the StringDictionary. value − The string value to associate with the specified key when ...
Read MoreTimeSpan.FromMilliseconds() Method in C#
The TimeSpan.FromMilliseconds() method in C# is used to return a TimeSpan that represents a specified number of milliseconds. This static method is particularly useful when you need to create time intervals based on millisecond values, such as delays, timeouts, or performance measurements. Syntax Following is the syntax for the TimeSpan.FromMilliseconds() method − public static TimeSpan FromMilliseconds(double value); Parameters The method accepts one parameter − value − A double that represents the number of milliseconds. It can be positive, negative, or zero. Return Value The method returns a TimeSpan ...
Read MoreStack.Contains() Method in C#
The Stack.Contains() method in C# is used to check whether a specific element exists in the Stack or not. It returns true if the element is found, otherwise false. Syntax The syntax for the Stack.Contains() method is as follows − public virtual bool Contains(object obj); Parameters obj − The object to be searched in the stack. It can be null. Return Value Returns a bool value − true − if the element is found in the Stack false − if the element is not found in the ...
Read MoreGets or sets the value in HybridDictionary with specified key in C#
The HybridDictionary class in C# provides an indexer property that allows you to get or set values using a specified key. The HybridDictionary is part of the System.Collections.Specialized namespace and combines the benefits of both ListDictionary and Hashtable for optimal performance with small and large collections. Syntax Following is the syntax for getting or setting values in HybridDictionary using the indexer − // Getting a value object value = hybridDict[key]; // Setting a value hybridDict[key] = value; Parameters key − The key of the element to get or set. Can ...
Read MoreBoolean.ToString(IFormatProvider) Method in C#
The Boolean.ToString(IFormatProvider) method in C# converts a Boolean value to its equivalent string representation. This method accepts an IFormatProvider parameter, though Boolean values are not culture-sensitive and always return "True" or "False" regardless of the culture specified. Syntax Following is the syntax for the Boolean.ToString(IFormatProvider) method − public string ToString(IFormatProvider provider); Parameters provider − An IFormatProvider object that provides culture-specific formatting information. This parameter is reserved but not used for Boolean values. Return Value Returns a string representation of the Boolean value. The method returns "True" for true values ...
Read More