Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by AmitDiwan
Page 215 of 840
Int32.GetTypeCode Method in C# with Examples
The Int32.GetTypeCode() method in C# returns the TypeCode enumeration value for the Int32 data type. This method is inherited from the IConvertible interface and is useful for type identification and runtime type checking operations. Syntax Following is the syntax − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.Int32 for all int values, regardless of their actual numeric value. Using GetTypeCode() for Type Identification Example Let us see an example to implement the Int32.GetTypeCode() method − using System; public class Demo { public ...
Read MoreInt16.CompareTo() Method in C#
The Int16.CompareTo() method in C# is used to compare a 16-bit signed integer (short) with another value and returns an integer that indicates their relative order. This method is essential for sorting operations and determining the relationship between two Int16 values. Syntax The Int16.CompareTo() method has two overloads − public int CompareTo(short value); public int CompareTo(object value); Parameters value − A 16-bit signed integer or an object to compare with the current instance. Return Value The method returns an integer with the following meaning − ...
Read MoreUInt64.CompareTo() Method in C# with Examples
The UInt64.CompareTo() method in C# is used to compare the current instance to a specified object or UInt64 and returns an indication of their relative values. This method is essential for sorting operations and numerical comparisons with 64-bit unsigned integers. Syntax The UInt64.CompareTo() method has two overloads − public int CompareTo(object val); public int CompareTo(ulong val); Parameters val − An object or unsigned 64-bit integer to compare with the current instance. Return Value The method returns an integer that indicates the relative position of the current instance ...
Read MoreDecimal.ToDouble() Method in C#
The Decimal.ToDouble() method in C# is used to convert the value of the specified Decimal to the equivalent double-precision floating-point number. This conversion is useful when you need to perform operations that require double precision or when interfacing with APIs that expect double values. Syntax Following is the syntax − public static double ToDouble(decimal val); Parameters val − The decimal number to convert to a double-precision floating-point number. Return Value A double-precision floating-point number that is equivalent to the specified decimal value. Using Decimal.ToDouble() with Small Values Let us ...
Read MoreUInt64.Equals Method in C# with Examples
The UInt64.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt64. This method provides a way to compare 64-bit unsigned integer values for equality, offering both generic object comparison and type-specific comparison overloads. Syntax Following is the syntax for both overloads of the UInt64.Equals() method − public override bool Equals(object obj); public bool Equals(ulong value); Parameters The UInt64.Equals() method accepts the following parameters − obj − An object to compare to this instance (first overload) value − A 64-bit unsigned integer to ...
Read MoreDecimal.ToInt16() Method in C#
The Decimal.ToInt16() method in C# is used to convert the value of the specified Decimal to the equivalent 16-bit signed integer (short). This method performs truncation, discarding any fractional part of the decimal number. Syntax Following is the syntax − public static short ToInt16(decimal val); Parameters val − The decimal number to convert. Return Value Returns a 16-bit signed integer (short) that is equivalent to the decimal value after truncation. The range of short is -32, 768 to 32, 767. Using Decimal.ToInt16() with Positive and Negative Values The method ...
Read MoreMathF.Round() Method in C# with Examples
The MathF.Round() method in C# is used to round a float value to the nearest integer or to a specified number of fractional digits. This method provides several overloads to handle different rounding scenarios and midpoint rounding behaviors. Syntax Following are the different overloads of the MathF.Round() method − public static float Round(float x); public static float Round(float x, int digits); public static float Round(float x, int digits, MidpointRounding mode); public static float Round(float x, MidpointRounding mode); Parameters x − The float number to be rounded. digits − The number of fractional ...
Read MoreUInt64.GetTypeCode() Method in C# with Examples
The UInt64.GetTypeCode() method in C# returns the TypeCode enumeration value for the UInt64 data type. This method is inherited from the IConvertible interface and helps identify the specific type of a value at runtime. The TypeCode enumeration provides a way to categorize the built-in .NET data types, making it useful for type checking and conversion operations. Syntax Following is the syntax − public TypeCode GetTypeCode(); Return Value This method always returns TypeCode.UInt64 for any ulong value, as all UInt64 instances belong to the same data type. Example Let us see ...
Read MoreType.GetInterface() Method in C#
The Type.GetInterface() method in C# is used to get a specific interface implemented or inherited by the current Type. This method searches through all interfaces implemented by a type and returns the one that matches the specified name. Syntax Following are the overloads of the GetInterface() method − public Type GetInterface(string name); public abstract Type GetInterface(string name, bool ignoreCase); Parameters name − The name of the interface to find. ignoreCase − A Boolean value indicating whether to perform a case-insensitive search for the interface name. Return ...
Read MoreUInt16.ToString Method in C# with Examples
The UInt16.ToString() method in C# is used to convert the numeric value of the current UInt16 instance to its equivalent string representation. The UInt16 data type represents a 16-bit unsigned integer with a range from 0 to 65, 535. This method has multiple overloads that allow you to format the string representation using different format specifiers, culture-specific formatting, and format providers. Syntax Following is the syntax for the basic ToString() method − public override string ToString() Following is the syntax for ToString() with format specifier − public string ToString(string format) ...
Read More