AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 212 of 840

Dictionary.Keys Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 389 Views

The Dictionary.Keys property in C# is used to fetch all the keys in the Dictionary. This property returns a KeyCollection that contains all the keys from the dictionary, which can be iterated through using a foreach loop. Syntax Following is the syntax − public System.Collections.Generic.Dictionary.KeyCollection Keys { get; } Return Value The Keys property returns a Dictionary.KeyCollection containing all the keys in the dictionary. This collection is a live view of the keys, meaning if the dictionary changes, the collection reflects those changes. Using Dictionary.Keys Property Example Let us see ...

Read More

Char.ToString() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 216 Views

The Char.ToString() method in C# is used to convert a character to its equivalent string representation. This method is particularly useful when you need to convert a single character into a string for string operations or concatenation. Syntax Following is the syntax for the Char.ToString() method − public override string ToString(); Return Value The method returns a string object containing the character value converted to its string representation. Using Char.ToString() Method Example 1 - Converting Lowercase Character Let us see an example to convert a lowercase character to its string ...

Read More

DateTimeOffset.AddTicks() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 278 Views

The DateTimeOffset.AddTicks() method in C# is used to add a specified number of ticks to the value of a DateTimeOffset instance. A tick represents 100 nanoseconds, making it the smallest unit of time measurement in .NET. Syntax Following is the syntax − public DateTimeOffset AddTicks(long ticks); Parameters ticks: A signed 64-bit integer representing the number of 100-nanosecond ticks to add. To subtract ticks, use a negative value. Return Value Returns a new DateTimeOffset instance with the specified ticks added to the original value. The original instance remains unchanged. Understanding Tick ...

Read More

How to create 5-Tuple or quintuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 191 Views

A 5-tuple or quintuple in C# is represented by the Tuple class, which is a data structure that holds exactly five elements of potentially different types. Each element can be accessed through its corresponding Item property. Syntax Following is the syntax for creating a 5-tuple using the constructor − Tuple tuple = new Tuple(item1, item2, item3, item4, item5); You can also use the Tuple.Create() method for shorter syntax − var tuple = Tuple.Create(item1, item2, item3, item4, item5); Properties A 5-tuple has five read-only properties to access its elements − ...

Read More

Math.BigMul() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 303 Views

The Math.BigMul() method in C# is used to calculate the full product of two 32-bit integers. This method is particularly useful when multiplying large integers that might produce a result exceeding the range of a 32-bit integer, as it returns a 64-bit long value to accommodate the full product. Syntax Following is the syntax − public static long BigMul(int val1, int val2); Parameters val1: The first 32-bit integer to multiply val2: The second 32-bit integer to multiply Return Value Returns a long (64-bit integer) containing ...

Read More

How to create 6-Tuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 196 Views

A 6-tuple in C# is represented by the Tuple class, which is a data structure that holds exactly six elements of potentially different types. Tuples are useful for grouping related data together without creating a custom class or struct. The 6-tuple provides six properties to access its elements: Item1 through Item6, each corresponding to the respective component in the tuple. Syntax Following is the syntax for creating a 6-tuple − Tuple tupleName = new Tuple(value1, value2, value3, value4, value5, value6); You can also use the Tuple.Create() method for shorter syntax − ...

Read More

Decimal.ToUInt16() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 106 Views

The Decimal.ToUInt16() method in C# is used to convert the value of the specified Decimal to the equivalent 16-bit unsigned integer (ushort). This method performs a narrowing conversion, truncating any fractional part. Syntax Following is the syntax − public static ushort ToUInt16(decimal val); Parameters val − The decimal number to convert to a 16-bit unsigned integer. Return Value Returns a ushort value that represents the converted decimal. The fractional part is truncated (not rounded). How It Works The method truncates the decimal value to the ...

Read More

How to create 7-Tuple or Septuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 171 Views

The Tuple class represents a 7-tuple, also known as a septuple. A tuple is a data structure that contains a fixed number of elements in a specific sequence, allowing you to group related values together. 7-tuples are commonly used for − Easier access to a data set with seven related values. Easier manipulation of a data set. To represent a single set of data with seven components. To return multiple values from a method. To pass multiple values to a method. Syntax Following is the syntax for creating a 7-tuple in C# − ...

Read More

DateTime.SpecifyKind() Method in C#

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

The DateTime.SpecifyKind() method in C# is used to create a new DateTime object that has the same number of ticks as the specified DateTime but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value. This method is particularly useful when you have a DateTime value but need to explicitly specify its time zone context without changing the actual time value. The original DateTime remains unchanged − a new instance is returned with the specified Kind property. Syntax Following is the syntax for the DateTime.SpecifyKind() method − ...

Read More

DateTimeOffset.GetHashCode() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 155 Views

The DateTimeOffset.GetHashCode() method in C# returns a hash code for the current DateTimeOffset object. This method is inherited from the Object class and provides a 32-bit signed integer that represents the unique identifier for the DateTimeOffset instance, which is useful for hash-based collections like Dictionary and HashSet. Syntax Following is the syntax for the GetHashCode() method − public override int GetHashCode(); Return Value This method returns a 32-bit signed integer hash code that represents the current DateTimeOffset object. Two DateTimeOffset objects that are equal will have the same hash code, but objects with ...

Read More
Showing 2111–2120 of 8,392 articles
« Prev 1 210 211 212 213 214 840 Next »
Advertisements