Csharp Articles

Page 188 of 196

DateTimeOffset.AddHours() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 348 Views

The DateTimeOffset.AddHours() method in C# is used to add a specified number of whole and fractional hours to the value of a DateTimeOffset instance. This method returns a new DateTimeOffset object that represents the original date and time plus the specified hours, while preserving the original offset from UTC. Syntax Following is the syntax − public DateTimeOffset AddHours(double hours); Parameters hours − A double value representing the number of hours to add. This can be a whole number or fractional value. To subtract hours, provide a negative value. Return Value Returns ...

Read More

DateTimeOffset.AddMilliseconds() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 149 Views

The DateTimeOffset.AddMilliseconds() method in C# returns a new DateTimeOffset object that adds a specified number of milliseconds to the value of the current instance. This method is useful for precise time calculations where millisecond accuracy is required. The method accepts a double parameter representing the number of milliseconds to add. To subtract milliseconds, pass a negative value. The original DateTimeOffset instance remains unchanged as this method returns a new instance. Syntax Following is the syntax − public DateTimeOffset AddMilliseconds(double value); Parameters value − A double representing the number of milliseconds to ...

Read More

Boolean.Equals(Boolean) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 513 Views

The Boolean.Equals(Boolean) method in C# returns a value indicating whether this instance is equal to a specified Boolean object. This method compares the current Boolean instance with another Boolean value and returns true if they are equal, otherwise false. Syntax Following is the syntax − public bool Equals(bool obj); Parameters obj − A Boolean value to compare to this instance. Return Value This method returns true if obj has the same value as this instance; otherwise, false. Example Let us see an example to implement the Boolean.Equals(Boolean) ...

Read More

Boolean.Equals(Object) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 222 Views

The Boolean.Equals(Object) method in C# returns a value indicating whether the current Boolean instance is equal to a specified object. This method compares the Boolean value with another object, returning true only if the object is also a Boolean with the same value. Syntax Following is the syntax − public override bool Equals (object obj); Parameters obj − An object to compare with this Boolean instance. Return Value Returns true if the object is a Boolean instance with the same value; otherwise, false. Using Boolean.Equals() with Different Data Types ...

Read More

Boolean.Parse() Method in C#

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

The Boolean.Parse() method in C# is used to convert the specified string representation of a logical value to its Boolean equivalent. This method converts strings like "true", "false", "TRUE", or "FALSE" to their corresponding boolean values. Syntax Following is the syntax − public static bool Parse(string value); Parameters value − A string containing the value to convert. It can be "true", "false", "True", "False", "TRUE", or "FALSE". Return Value Returns true if the value is equivalent to TrueString, or false if the value is equivalent to FalseString. Using ...

Read More

Boolean.ToString() Method in C#

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

The Boolean.ToString() method in C# converts a boolean value to its equivalent string representation. It returns "True" for true values and "False" for false values. Syntax Following is the syntax − public override string ToString(); Return Value The method returns a string that represents the current boolean value − Returns "True" if the boolean value is true Returns "False" if the boolean value is false Using Boolean.ToString() with True Value Example using System; public class Demo { ...

Read More

Type.GetProperties() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 557 Views

The Type.GetProperties() method in C# is used to retrieve information about the properties of a specific type at runtime using reflection. This method returns an array of PropertyInfo objects that represent all the properties of the specified type. Syntax Following are the two main overloads of the GetProperties() method − public PropertyInfo[] GetProperties(); public PropertyInfo[] GetProperties(BindingFlags bindingAttr); Parameters bindingAttr − A bitwise combination of BindingFlags enumeration values that specify how the search is conducted. This parameter controls which properties are returned based on their accessibility and binding characteristics. Return Value ...

Read More

Type.GetTypeArray() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 134 Views

The Type.GetTypeArray() method in C# is used to retrieve the Type objects representing the runtime types of all elements in a specified object array. This method is particularly useful in reflection scenarios where you need to determine the actual types of objects at runtime. Syntax Following is the syntax − public static Type[] GetTypeArray (object[] args); Parameters args − An array of objects whose types are to be determined. Return Value This method returns an array of Type objects representing the types of the corresponding elements in ...

Read More

Type.GetTypeCode() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 277 Views

The Type.GetTypeCode() method in C# is used to get the underlying type code of the specified Type. It returns a TypeCode enumeration value that represents the type classification of the given Type object. Syntax Following is the syntax − public static TypeCode GetTypeCode(Type type); Parameters type − The Type object whose underlying type code is to be retrieved. Return Value Returns a TypeCode enumeration value that represents the type category. If the type is null, it returns TypeCode.Empty. Using GetTypeCode() with Built-in Types Example ...

Read More

Int32. Equals Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 305 Views

The Int32.Equals() method in C# is used to compare the current integer instance with another value to determine if they are equal. It returns a boolean value indicating whether the comparison values are equal or not. Syntax The Int32.Equals() method has two overloaded forms − public bool Equals(int other); public override bool Equals(object obj); Parameters other − An Int32 value to compare with the current instance. obj − An object to compare with the current instance. Return Value Both overloads return a bool value − true if ...

Read More
Showing 1871–1880 of 1,951 articles
« Prev 1 186 187 188 189 190 196 Next »
Advertisements