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 on Trending Technologies
Technical articles with clear explanations and examples
Double.IsInfinity() Method in C#
The Double.IsInfinity() method in C# is used to determine whether a double-precision floating-point number represents positive or negative infinity. This method returns true if the specified number evaluates to either PositiveInfinity or NegativeInfinity, and false otherwise. Infinity values in C# occur when mathematical operations exceed the range of double values, such as dividing a non-zero number by zero or performing calculations that result in overflow. Syntax Following is the syntax for the Double.IsInfinity() method − public static bool IsInfinity(double d); Parameters d − A double-precision floating-point number to test for infinity. ...
Read MoreRemoving the specified node from the LinkedList in C#?
The LinkedList class in C# provides several methods to remove nodes from the linked list. You can remove nodes by value using Remove() method or remove specific node references using Remove(LinkedListNode). Syntax Following are the different syntaxes for removing nodes from a LinkedList − // Remove by value (removes first occurrence) bool Remove(T value) // Remove specific node void Remove(LinkedListNode node) // Remove first node void RemoveFirst() // Remove last node void RemoveLast() Return Value The Remove(T value) method returns true if the element is successfully removed; otherwise, false. Other ...
Read MoreUri.IsHexEncoding() Method in C#
The Uri.IsHexEncoding() method in C# determines whether a character at a specific position in a string is hexadecimal encoded. This method is useful when working with URIs that contain percent-encoded characters, where hexadecimal encoding follows the pattern %XX (a percent sign followed by two hexadecimal digits). Syntax Following is the syntax − public static bool IsHexEncoding(string pattern, int index); Parameters pattern − The string to check for hexadecimal encoding. index − The zero-based position in the pattern where the check should begin. Return Value Returns ...
Read MoreTimeSpan.Add() Method in C#
The TimeSpan.Add() method in C# returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and the current instance. This method is useful for adding time intervals together, such as combining durations or calculating elapsed time periods. Syntax Following is the syntax for the TimeSpan.Add() method − public TimeSpan Add(TimeSpan span); Parameters span − A TimeSpan object representing the time interval to add to the current TimeSpan instance. Return Value Returns a new TimeSpan object that represents the sum of the current TimeSpan and the specified ...
Read MoreGet the number of elements contained in the Stack in C#
The Count property in C# provides an efficient way to get the number of elements contained in a Stack. This property returns an integer value representing the current number of items stored in the stack. Syntax Following is the syntax for using the Count property − Stack stack = new Stack(); int count = stack.Count; Return Value The Count property returns an int value representing the number of elements in the stack. For an empty stack, it returns 0. Stack Count Property ...
Read MoreInsert a new entry in OrderedDictionary with specified key and value in C#
The OrderedDictionary class in C# provides the Insert method to add a new entry at a specific position while maintaining the order of existing elements. This method allows you to specify both the index position and the key-value pair to insert. Syntax Following is the syntax for inserting an entry at a specific position in an OrderedDictionary − orderedDictionary.Insert(index, key, value); Parameters index − The zero-based index at which to insert the key-value pair. key − The key of the entry to insert. value − The value ...
Read MoreUri.IsWellFormedOriginalString() Method in C#
The Uri.IsWellFormedOriginalString() method in C# determines whether the original string used to construct a Uri object was well-formed and doesn't require additional escaping. This method returns true if the URI string is properly formatted according to RFC standards, and false otherwise. This method is particularly useful when validating URI strings before processing them or when you need to ensure that a URI doesn't contain characters that require percent-encoding. Syntax Following is the syntax for the IsWellFormedOriginalString() method − public bool IsWellFormedOriginalString(); Return Value The method returns a bool value − ...
Read MoreTimeSpan.Compare() Method in C#
The TimeSpan.Compare() method in C# is a static method used to compare two TimeSpan values and returns an integer that indicates their relative relationship. This method is useful for sorting operations and determining the order of time intervals. Syntax Following is the syntax for the TimeSpan.Compare() method − public static int Compare(TimeSpan span1, TimeSpan span2); Parameters span1 − The first TimeSpan value to compare. span2 − The second TimeSpan value to compare. Return Value The method returns an integer with the following meaning − Return ...
Read MoreGet the number of elements in the SortedSet in C#
The Count property in C# returns the number of elements currently stored in a SortedSet. This property provides an efficient way to determine the size of the collection without having to iterate through all elements. Syntax Following is the syntax for getting the count of elements in a SortedSet − int elementCount = sortedSet.Count; Return Value The Count property returns an int value representing the total number of elements in the SortedSet. For an empty SortedSet, it returns 0. Using Count Property with String SortedSet The following example demonstrates how to ...
Read MoreNumber of elements in HashSet in C#?
To get the number of elements in a HashSet in C#, use the Count property. The Count property returns an integer representing the total number of unique elements stored in the HashSet. Syntax Following is the syntax for getting the count of elements in a HashSet − HashSet hashSet = new HashSet(); int count = hashSet.Count; Using Count Property with Integer HashSet The following example demonstrates how to get the number of elements in HashSets containing integers − using System; using System.Collections.Generic; public class Demo { public ...
Read More