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
Csharp Articles
Page 192 of 196
MathF.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 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 MoreMathF.Atanh() Method in C# with Examples
The MathF.Atanh() method in C# returns the hyperbolic arc-tangent of a single-precision floating-point value. The hyperbolic arc-tangent is the inverse of the hyperbolic tangent function and is defined only for values in the range (-1, 1). For values outside this range, the method returns NaN (Not a Number). The method is useful in mathematical calculations involving hyperbolic functions and inverse transformations. Syntax Following is the syntax − public static float Atanh(float val); Parameters val − A single-precision floating-point number representing the hyperbolic tangent whose inverse is to be found. Must ...
Read MoreChar.IsLetterOrDigit() Method in C#
The Char.IsLetterOrDigit() method in C# determines whether a specified Unicode character is categorized as a letter or a decimal digit. This method is useful for validating input characters, parsing strings, and filtering alphanumeric content. Syntax Following is the syntax for the Char.IsLetterOrDigit() method − public static bool IsLetterOrDigit(char ch); There is also an overloaded version that works with strings − public static bool IsLetterOrDigit(string s, int index); Parameters ch − The Unicode character to evaluate. s − A string. index − The position of the character to evaluate ...
Read MoreChar.IsLower() Method in C#
The Char.IsLower() method in C# is used to determine whether a specified Unicode character is categorized as a lowercase letter. This method is part of the System.Char class and provides a convenient way to validate character case in string processing operations. Syntax Following is the syntax for the Char.IsLower() method − public static bool IsLower(char ch); Parameters ch − The Unicode character to evaluate. Return Value Returns true if the character is a lowercase letter; otherwise, false. Using Char.IsLower() with Uppercase Characters The following example ...
Read MoreDecimal.ToInt32() Method in C#
The Decimal.ToInt32() method in C# is used to convert the value of the specified Decimal to the equivalent 32-bit signed integer. This method performs truncation, meaning it removes the fractional part without rounding. Syntax Following is the syntax − public static int ToInt32(decimal val); Parameters val − The decimal number to convert to a 32-bit signed integer. Return Value Returns an int value that represents the truncated decimal value. If the decimal has fractional digits, they are discarded (not rounded). How It Works The method truncates the decimal value ...
Read MoreDecimal.ToInt64() Method in C#
The Decimal.ToInt64() method in C# is used to convert the value of the specified Decimal to the equivalent 64-bit signed integer (long). This method truncates the decimal portion, returning only the whole number part. Syntax Following is the syntax − public static long ToInt64(decimal val); Parameters val − The decimal number to convert to a 64-bit signed integer. Return Value This method returns a long value that represents the truncated decimal value. The fractional part is discarded, not rounded. How It Works The method performs ...
Read MoreUInt64.ToString() Method in C# with Examples
The UInt64.ToString() method in C# is used to convert the numeric value of the current UInt64 instance to its equivalent string representation. This method is particularly useful when you need to display UInt64 values as text or perform string operations on numeric data. Syntax Following is the syntax for the parameterless overload − public override string ToString(); The method also has additional overloads for custom formatting − public string ToString(string format); public string ToString(IFormatProvider provider); public string ToString(string format, IFormatProvider provider); Return Value Returns a string that represents the ...
Read MoreUri.CheckHostName(String) Method in C#
The Uri.CheckHostName() method in C# is used to determine the type of hostname specified in a string. It validates whether the given string represents a valid DNS name, IPv4 address, IPv6 address, or an unknown format. Syntax Following is the syntax − public static UriHostNameType CheckHostName(string hostName); Parameters hostName − A string that contains the hostname to validate. Return Value The method returns a UriHostNameType enumeration value that indicates the type of the hostname − UriHostNameType Description Dns Valid ...
Read MoreUri.CheckSchemeName(String) Method in C#
The Uri.CheckSchemeName() method in C# is used to determine whether the specified scheme name is valid. A valid scheme name must start with a letter and can contain only letters, digits, plus (+), period (.), or hyphen (-) characters. Syntax Following is the syntax − public static bool CheckSchemeName(string schemeName); Parameters schemeName − The scheme name to validate as a string. Return Value Returns true if the scheme name is valid; otherwise, false. Valid vs Invalid Scheme Names Valid ...
Read More