AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 202 of 840

Get the hyperbolic arc-cosine of a floating-point value in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 201 Views

To get the hyperbolic arc-cosine of a floating-point value in C#, you use the MathF.Acosh() method for float values or Math.Acosh() method for double values. The hyperbolic arc-cosine function returns the value whose hyperbolic cosine is the specified number. Syntax Following is the syntax for the hyperbolic arc-cosine methods − // For float values public static float Acosh(float x) // For double values public static double Acosh(double x) Parameters x − A number representing a hyperbolic cosine, where x must be greater than or equal to 1. ...

Read More

Convert the specified Windows file time to an equivalent local time in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 304 Views

To convert the specified Windows file time to an equivalent local time in C#, you can use the DateTimeOffset.FromFileTime() method. This method converts a Windows file time (represented as a 64-bit integer) to a DateTimeOffset value that represents the equivalent local time. Windows file time is measured as the number of 100-nanosecond intervals that have elapsed since January 1, 1601 UTC. The FromFileTime method automatically adjusts the result to the local time zone of the system. Syntax Following is the syntax for converting Windows file time to local time − DateTimeOffset localTime = DateTimeOffset.FromFileTime(fileTime); ...

Read More

Get the angle whose sine is float value argument in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 208 Views

To get the angle whose sine is a float value argument in C#, we use the MathF.Asin() method. This method returns the arcsine (inverse sine) of the specified number in radians. The input value must be between -1 and 1, otherwise the method returns NaN (Not a Number). Syntax Following is the syntax for MathF.Asin() method − public static float Asin(float x) Parameters x − A number representing a sine value. Must be between -1 and 1 inclusive. Return Value Returns the arcsine of the specified number in radians. ...

Read More

Get the HashCode for the current UInt32 instance in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 172 Views

The GetHashCode() method in C# returns a hash code for the current UInt32 instance. This hash code is used internally by hash-based collections like Dictionary and HashSet for efficient storage and retrieval operations. For UInt32 values, the hash code is typically the value itself, making it straightforward to understand and predict. Syntax Following is the syntax for getting the hash code of a UInt32 instance − uint value = 100; int hashCode = value.GetHashCode(); Return Value The GetHashCode()

Read More

TimeSpan.FromMinutes() Method in C#

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

The TimeSpan.FromMinutes() method in C# is used to return a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond. This static method is particularly useful when you need to create time intervals based on minute values. Syntax Following is the syntax for the TimeSpan.FromMinutes() method − public static TimeSpan FromMinutes(double value); Parameters value − A double representing the number of minutes, accurate to the nearest millisecond. Can be positive or negative. Return Value Returns a TimeSpan object that represents ...

Read More

TimeSpan.FromSeconds() Method in C#

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

The TimeSpan.FromSeconds() method in C# is used to return a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond. This static method is particularly useful when you need to create time intervals based on second values. Syntax Following is the syntax for the TimeSpan.FromSeconds() method − public static TimeSpan FromSeconds(double value); Parameters value − A number of seconds, accurate to the nearest millisecond. Can be positive, negative, or zero. Return Value Returns a TimeSpan object that represents the specified number of ...

Read More

Get an ICollection containing keys in OrderedDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 203 Views

The OrderedDictionary class in C# maintains the insertion order of elements. To get an ICollection containing keys from an OrderedDictionary, you can use the Keys property which returns an ICollection object containing all the keys in their insertion order. Syntax Following is the syntax to get keys as an ICollection from OrderedDictionary − OrderedDictionary dict = new OrderedDictionary(); ICollection keys = dict.Keys; Using Keys Property with CopyTo Method The most common approach is to use the Keys property and copy the keys to a string array using the CopyTo method − ...

Read More

C# BitConverter.ToUInt16() Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 450 Views

The BitConverter.ToUInt16() method in C# converts two consecutive bytes from a byte array into a 16-bit unsigned integer (ushort). This method is particularly useful when working with binary data, network protocols, or file formats that store numeric values as byte sequences. Syntax public static ushort ToUInt16(byte[] value, int startIndex); Parameters value: The byte array containing the bytes to convert. startIndex: The starting position within the byte array (must have at least 2 bytes remaining). Return Value Returns a 16-bit unsigned integer (ushort) formed by combining two bytes from the specified ...

Read More

Check if HashSet and the specified collection contain the same elements in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 210 Views

To check if a HashSet and another collection contain the same elements in C#, use the SetEquals() method. This method returns true if both collections have identical elements, regardless of order, and false otherwise. Syntax Following is the syntax for the SetEquals() method − public bool SetEquals(IEnumerable other) Parameters other − The collection to compare with the current HashSet. Return Value Returns true if the HashSet and the specified collection contain the same elements; otherwise, false. Using SetEquals() with Different Elements When the HashSet and another collection ...

Read More

Fetch the maximum value from a MySQL column?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 246 Views

To fetch the maximum value from a MySQL column in C#, you need to establish a database connection and execute a query using either the MAX() function or ORDER BY with LIMIT. This tutorial demonstrates both approaches using MySQL.Data.MySqlClient. Syntax Following is the syntax for fetching maximum value using the MAX() function − SELECT MAX(column_name) FROM table_name; Following is the syntax using ORDER BY with LIMIT − SELECT column_name FROM table_name ORDER BY column_name DESC LIMIT 1; Database Setup First, let us create a table and insert sample data ...

Read More
Showing 2011–2020 of 8,392 articles
« Prev 1 200 201 202 203 204 840 Next »
Advertisements