Programming Articles

Page 723 of 2547

Uri.IsHexEncoding() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 125 Views

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 More

TimeSpan.Add() Method in C#

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

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 More

Get the number of elements contained in the Stack in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 299 Views

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 More

Insert a new entry in OrderedDictionary with specified key and value in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 180 Views

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 More

Uri.IsWellFormedOriginalString() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 130 Views

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 More

TimeSpan.Compare() Method in C#

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

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 More

Get the number of elements in the SortedSet in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 181 Views

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 More

Number of elements in HashSet in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 283 Views

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

How to check Minlength and Maxlength validation of a property in C# using Fluent Validation?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 3K+ Views

FluentValidation is a popular .NET validation library that provides an easy way to validate model properties. The MinLength and MaxLength validators ensure that string properties meet specific length requirements, making them essential for input validation scenarios. Syntax Following is the syntax for using MaximumLength validator − RuleFor(x => x.PropertyName).MaximumLength(maxValue); Following is the syntax for using MinimumLength validator − RuleFor(x => x.PropertyName).MinimumLength(minValue); MaxLength Validator The MaximumLength validator ensures that the length of a string property does not exceed the specified maximum value. This validator is only valid on string properties. ...

Read More

UInt64 Struct in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 486 Views

The UInt64 struct in C# represents a 64-bit unsigned integer with values ranging from 0 to 18, 446, 744, 073, 709, 551, 615. This struct provides various methods for comparison, equality checks, and other operations on unsigned 64-bit integers. UInt64 Value Range 0 18, 446, 744, 073, 709, 551, 615 64-bit Unsigned Integer 2^64 - 1 possible values UInt64.CompareTo() Method The UInt64.CompareTo() method compares the current instance to a specified object or UInt64 value and returns an indication of their ...

Read More
Showing 7221–7230 of 25,466 articles
« Prev 1 721 722 723 724 725 2547 Next »
Advertisements