Server Side Programming Articles

Page 853 of 2109

Type.GetFields() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 370 Views

The Type.GetFields() method in C# is used to retrieve the fields of the current Type using reflection. This method returns an array of FieldInfo objects representing the fields that match the specified binding criteria. Fields are data members of a class that store values. The GetFields() method allows you to examine both public and non-public fields at runtime, making it useful for inspection, debugging, and dynamic programming scenarios. Syntax Following is the syntax for the parameterless overload − public System.Reflection.FieldInfo[] GetFields(); Following is the syntax for the overload with binding flags − ...

Read More

DateTime.Add() Method in C#

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

The DateTime.Add() method in C# is used to return a new DateTime that adds the value of the specified TimeSpan to the value of this instance. This method allows you to add or subtract time intervals including days, hours, minutes, seconds, and milliseconds. Syntax Following is the syntax − public DateTime Add(TimeSpan value); Parameters value − A positive or negative TimeSpan that represents the time interval to add to the current DateTime instance. Return Value Returns a new DateTime object whose value is the sum of the ...

Read More

DateTime.AddDays() Method in C#

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

The DateTime.AddDays() method in C# is used to add the specified number of days to the value of this instance. This method returns a new DateTime object without modifying the original instance, as DateTime is immutable. Syntax Following is the syntax − public DateTime AddDays(double days); Parameters days − A number of whole and fractional days. The value parameter can be negative or positive. Return Value This method returns a new DateTime object whose value is the sum of the date and time represented by this instance and the ...

Read More

DateTime.AddHours() Method in C#

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

The DateTime.AddHours() method in C# is used to add the specified number of hours to the value of this instance. This method returns a new DateTime object, leaving the original instance unchanged. Syntax Following is the syntax − public DateTime AddHours(double hrs); Parameters hrs − A number of hours to be added. The value can be positive (to add hours) or negative (to subtract hours). Fractional values represent parts of an hour. Return Value Returns a new DateTime object that represents the date and time that results from adding the specified ...

Read More

Convert.ToDouble(String, IFormatProvider) Method in C#

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

The Convert.ToDouble(String, IFormatProvider) method in C# converts a string representation of a number to an equivalent double-precision floating-point number using specified culture-specific formatting information. This method is particularly useful when working with numeric strings that follow different regional formatting conventions. Syntax Following is the syntax − public static double ToDouble(string value, IFormatProvider provider); Parameters value − A string that contains the number to convert. provider − An object that supplies culture-specific formatting information. If null, the current culture is used. Return Value Returns a double-precision floating-point number equivalent to ...

Read More

Convert.ToSByte(String, IFormatProvider) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 210 Views

The Convert.ToSByte(String, IFormatProvider) method in C# converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified culture-specific formatting information. This method is particularly useful when working with numeric strings that may have different formatting conventions based on locale. Syntax Following is the syntax − public static sbyte ToSByte(string value, IFormatProvider provider); Parameters value − A string that contains the number to convert. The value must be between -128 and 127. provider − An object that supplies culture-specific formatting information. This can be ...

Read More

Dictionary Class in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 993 Views

Dictionary in C# is a generic collection class that stores key-value pairs. It belongs to the System.Collections.Generic namespace and provides fast lookups based on keys. Each key in the dictionary must be unique, but values can be duplicated. Syntax Following is the syntax for declaring a Dictionary − public class Dictionary Where TKey is the type of keys and TValue is the type of values in the dictionary. To create and initialize a Dictionary − Dictionary dict = new Dictionary(); dict.Add(key, value); dict[key] = value; // Alternative way to add/update ...

Read More

Dictionary.Values Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 367 Views

The Dictionary.Values property in C# is used to retrieve all the values stored in a Dictionary. This property returns a ValueCollection that contains all values from the dictionary, preserving the order in which they were added. Syntax Following is the syntax for the Dictionary.Values property − public Dictionary.ValueCollection Values { get; } Return Value The property returns a Dictionary.ValueCollection containing all the values in the dictionary. This collection is a live view of the dictionary values, meaning changes to the dictionary are reflected in the collection. Dictionary.Values Property ...

Read More

DateTimeOffset.AddYears() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 109 Views

The DateTimeOffset.AddYears() method in C# is used to add a specified number of years to a DateTimeOffset instance. This method returns a new DateTimeOffset object representing the date and time with the added years, while preserving the original offset from UTC. Syntax Following is the syntax for the DateTimeOffset.AddYears() method − public DateTimeOffset AddYears(int years); Parameters The method takes one parameter − years − An integer representing the number of years to add. Use positive values to add years, negative values to subtract years. Return Value ...

Read More

DateTimeOffset.Compare() Method in C#

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

The DateTimeOffset.Compare() method in C# is used to compare two DateTimeOffset objects and indicates whether the first is earlier than the second, equal to the second, or later than the second. It returns an integer value that represents the relationship between the two dates. 0 − If val1 is later than val2 DateTimeOffset.Compare() Return Values < 0 val1 is earlier than val2 0 val1 equals val2 > 0 ...

Read More
Showing 8521–8530 of 21,090 articles
« Prev 1 851 852 853 854 855 2109 Next »
Advertisements