Csharp Articles

Page 31 of 196

Remove entry with specified key from OrderedDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 205 Views

The OrderedDictionary class in C# provides the Remove() method to remove entries with a specified key. The OrderedDictionary maintains the insertion order of elements while allowing both key-based and index-based access. Syntax Following is the syntax for removing an entry by key from an OrderedDictionary − orderedDictionary.Remove(key); Parameters key − The key of the entry to remove from the OrderedDictionary. Return Value The Remove() method does not return a value. It removes the entry if the key exists, or does nothing if the key is not found. ...

Read More

Remove entry with specified key from the StringDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 156 Views

The StringDictionary class in C# provides the Remove() method to delete entries with a specified key. This method removes both the key and its associated value from the collection. StringDictionary is case-insensitive, meaning keys are automatically converted to lowercase. Syntax Following is the syntax for the Remove() method − public virtual void Remove(string key) Parameters key − The string key to remove from the StringDictionary. Using Remove() Method Example using System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() ...

Read More

Get the TypeCode for value type Char in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 267 Views

The TypeCode for a char value type in C# can be obtained using the GetTypeCode() method. This method returns TypeCode.Char, which is an enumeration value that identifies the char data type. The GetTypeCode() method is inherited from the IConvertible interface and provides a way to determine the underlying type of a value at runtime. Syntax Following is the syntax to get the TypeCode for a char value − TypeCode typeCode = charVariable.GetTypeCode(); Return Value The method returns TypeCode.Char for char data types, which is part of the TypeCode enumeration. Using GetTypeCode() ...

Read More

Check whether the Unicode character is a lowercase letter in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 311 Views

To check whether a Unicode character is a lowercase letter in C#, we use the Char.IsLower() method. This method examines the Unicode character and returns true if it represents a lowercase letter according to Unicode standards, and false otherwise. Syntax Following is the syntax for the Char.IsLower() method − public static bool IsLower(char c) Parameters c − The Unicode character to evaluate Return Value The method returns a bool value − true if the character is a lowercase letter false if the character is not a lowercase ...

Read More

Compare this instance is equal to a specified object or Int64 in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 138 Views

The Equals() method in C# is used to compare whether the current instance of a long (Int64) is equal to a specified object or another Int64 value. This method performs value-based comparison and returns a boolean result. Syntax Following is the syntax for the Equals() method − public bool Equals(long value) public override bool Equals(object obj) Parameters value − A long value to compare with the current instance. obj − An object to compare with the current instance. Return Value Returns true if the current ...

Read More

Get the hash code for the current Int64 instance in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 191 Views

The GetHashCode() method in C# returns a hash code for the current Int64 instance. This method is inherited from the Object class and is commonly used in hash-based collections like Dictionary and HashSet to efficiently store and retrieve values. Hash codes are 32-bit integers that provide a quick way to compare objects for equality. Two equal Int64 values will always have the same hash code, but different values may occasionally produce the same hash code (called a collision). Syntax Following is the syntax for getting the hash code of an Int64 value − public override ...

Read More

Check whether the specified Unicode character is a punctuation mark in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 332 Views

The Char.IsPunctuation() method in C# determines whether a specified Unicode character is classified as a punctuation mark. This method returns true if the character belongs to any punctuation category, otherwise it returns false. Punctuation marks include characters like periods, commas, semicolons, exclamation points, question marks, brackets, and other symbols used for punctuation in text. Syntax Following is the syntax for the Char.IsPunctuation() method − public static bool IsPunctuation(char c) Parameters c − The Unicode character to evaluate. Return Value Returns true if the character is a ...

Read More

How to get Seventh Element of the Tuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 158 Views

A Tuple in C# is a data structure that can hold multiple values of different types. To access the seventh element of a tuple, you use the Item7 property. This property is available in tuples that have seven or more elements. Syntax Following is the syntax for accessing the seventh element of a tuple − var seventhElement = tupleName.Item7; For creating a tuple with seven elements − var tuple = Tuple.Create(item1, item2, item3, item4, item5, item6, item7); Using Item7 Property The Item7 property directly retrieves the seventh element from ...

Read More

Remove from the specified index of the StringCollection in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 192 Views

The StringCollection class in C# provides the RemoveAt() method to remove an element from a specified index. This method removes the string at the given index and shifts all subsequent elements one position to the left. Syntax Following is the syntax for the RemoveAt() method − stringCollection.RemoveAt(int index); Parameters index − The zero-based index of the element to remove from the StringCollection. Using RemoveAt() to Remove Single Element The following example demonstrates removing an element from a specific index in a StringCollection − using System; ...

Read More

Get or set the value associated with the specified key in StringDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 137 Views

The StringDictionary class in C# provides an indexer that allows you to get or set values associated with specified keys. This indexer uses the key as a parameter and returns or assigns the corresponding value. The StringDictionary is case-insensitive and specifically designed for string keys and values. Syntax Following is the syntax for the StringDictionary indexer − public virtual string this[string key] { get; set; } To get a value − string value = stringDictionary[key]; To set a value − stringDictionary[key] = value; Parameters ...

Read More
Showing 301–310 of 1,951 articles
« Prev 1 29 30 31 32 33 196 Next »
Advertisements