Server Side Programming Articles

Page 865 of 2109

DateTimeOffset.AddMonths() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 428 Views

The DateTimeOffset.AddMonths() method in C# is used to add a specified number of months to a DateTimeOffset instance. This method returns a new DateTimeOffset object with the month value adjusted while preserving the time zone offset information. Syntax Following is the syntax for the AddMonths() method − public DateTimeOffset AddMonths(int months); Parameters months − An integer representing the number of months to add. Use a positive value to add months or a negative value to subtract months. Return Value Returns a new DateTimeOffset object that represents the date and time that ...

Read More

DateTimeOffset.AddSeconds() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 394 Views

The DateTimeOffset.AddSeconds() method in C# returns a new DateTimeOffset object that adds a specified number of whole and fractional seconds to the value of the current instance. This method is useful for time calculations where you need to preserve timezone offset information. Syntax Following is the syntax − public DateTimeOffset AddSeconds(double val); Parameters val − A double representing the number of seconds to add. It can be positive (to add seconds) or negative (to subtract seconds). Fractional values are allowed. Return Value Returns a new DateTimeOffset object whose value is the ...

Read More

Dictionary.Add() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 378 Views

The Dictionary.Add() method in C# is used to add a specified key-value pair to the dictionary. This method adds elements to the dictionary and throws an exception if you try to add a duplicate key. Syntax Following is the syntax − public void Add(TKey key, TValue value) Parameters key − The key of the element to add. Cannot be null. value − The value of the element to add. Can be null for reference types. Return Value This method does not return any value. It ...

Read More

Dictionary.Item[] Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 513 Views

The Dictionary.Item[] property in C# provides a convenient way to get or set values in a Dictionary using indexer syntax. This property allows you to access dictionary values directly using square bracket notation with the key, similar to array indexing. Syntax Following is the syntax for the Dictionary.Item[] property − public TValue this[TKey key] { get; set; } Parameters key − The key of the element to get or set. Return Value The property returns the value associated with the specified key. If the key is not found when ...

Read More

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

DateTimeOffset.AddTicks() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 279 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 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

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

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

DateTimeOffset.ToFileTime() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 145 Views

The DateTimeOffset.ToFileTime() method in C# is used to convert the value of the current DateTimeOffset object to a Windows file time. The method returns an Int64 value representing the current DateTimeOffset object, expressed as a Windows file time. A Windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D. (UTC). This format is commonly used by Windows file systems to store file timestamps. Syntax Following is the syntax − public long ToFileTime(); Return Value The method returns a ...

Read More
Showing 8641–8650 of 21,090 articles
« Prev 1 863 864 865 866 867 2109 Next »
Advertisements