Server Side Programming Articles

Page 23 of 2110

Get the first node of the LinkedList in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 428 Views

The LinkedList in C# is a doubly linked list collection that provides efficient insertion and removal of elements. To get the first node of a LinkedList, you use the First property, which returns a LinkedListNode object containing the value and navigation references. Syntax Following is the syntax to access the first node of a LinkedList − LinkedListNode firstNode = linkedList.First; T firstValue = linkedList.First.Value; Properties First − Returns the first LinkedListNode in the LinkedList, or null if the list is empty. First.Value − Gets the actual value stored in ...

Read More

Get an enumerator that iterates through the List in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 592 Views

In C#, you can get an enumerator that iterates through a List using the GetEnumerator() method. An enumerator provides a way to access each element in a collection sequentially without exposing the underlying structure. The List class implements IEnumerable, which provides enumerator functionality. Syntax Following is the syntax to get an enumerator from a List − List.Enumerator enumerator = list.GetEnumerator(); Following is the syntax to iterate using the enumerator − while (enumerator.MoveNext()) { T currentElement = enumerator.Current; // process currentElement } How It Works ...

Read More

Check if a SortedList object contains a specific value in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 194 Views

The SortedList class in C# provides the ContainsValue() method to check if a specific value exists in the collection. This method returns true if the value is found, and false otherwise. Syntax Following is the syntax for the ContainsValue() method − public virtual bool ContainsValue(object value) Parameters value − The value to locate in the SortedList. The value can be null. Return Value Returns true if the SortedList contains an element with the specified value; otherwise, false. Using ContainsValue() - Value Found The following example ...

Read More

Queue.Count Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 210 Views

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 More

Queue.Dequeue Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 898 Views

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 More

C# String.IsNormalized Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 262 Views

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 More

TimeSpan.FromMilliseconds() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 634 Views

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 More

Stack.Contains() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 265 Views

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 More

Boolean.ToString(IFormatProvider) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 558 Views

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

Double.CompareTo Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The Double.CompareTo() method in C# compares the current double instance to another double value or object. It returns an integer that indicates whether the current value is less than, equal to, or greater than the compared value. Syntax Following are the two overloads of the Double.CompareTo() − public int CompareTo(double value); public int CompareTo(object value); Parameters value − A double-precision floating-point number or object to compare with the current instance. Return Value The method returns an integer with the following meaning − Less than ...

Read More
Showing 221–230 of 21,091 articles
« Prev 1 21 22 23 24 25 2110 Next »
Advertisements