Found 2628 Articles for Csharp

Decimal.ToInt64() Method in C#

AmitDiwan
Updated on 12-Nov-2019 10:30:37

39 Views

The Decimal.ToInt64() method in C# is used to convert the value of the specified Decimal to the equivalent 64-bit signed integer.SyntaxFollowing is the syntax −public static long ToInt64 (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToInt64() method −using System; public class Demo {    public static void Main(){       Decimal val1 = -567.7989m;       Decimal val2 = 456.000m;       Console.WriteLine("Decimal 1 = "+val1);       Console.WriteLine("Decimal 2 = "+val2);       long res1 = Decimal.ToInt64(val1);       long res2 = Decimal.ToInt64(val2); ... Read More

Decimal.ToInt32() Method in C#

AmitDiwan
Updated on 12-Nov-2019 10:28:34

44 Views

The Decimal.ToInt32() method in C# is used to convert the value of the specified Decimal to the equivalent 32-bit signed integer.SyntaxFollowing is the syntax −public static int ToInt32 (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToInt32() method −using System; public class Demo {    public static void Main(){       Decimal val1 = 0.001m;       Decimal val2 = 1.000m;       Console.WriteLine("Decimal 1 = "+val1);       Console.WriteLine("Decimal 2 = "+val2);       int res1 = Decimal.ToInt32(val1);       int res2 = Decimal.ToInt32(val2); ... Read More

Char.IsLowSurrogate(String, Int32) Method in C#

AmitDiwan
Updated on 12-Nov-2019 10:26:51

72 Views

The Char.IsLowSurrogate() method in C# indicates whether the Char object at the specified position in a string is a low surrogate.SyntaxFollowing is the syntax −public static bool IsLowSurrogate (string str, int index);Above, str is a string, whereas the index is the position of the character to evaluate in str.ExampleLet us now see an example to implement the Char.IsLowSurrogate() method −using System; public class Demo {    public static void Main(){       string str = new String(new char[] { 'k', 'm', 'g', 't', 'j', 'p', '\uDC00' });       bool res = Char.IsLowSurrogate(str, 6);       if ... Read More

Char.IsLower() Method in C#

AmitDiwan
Updated on 12-Nov-2019 10:25:13

201 Views

The Char.IsLower() method in C# is used to indicate whether the specified Unicode character is categorized as a lowercase letter.SyntaxFollowing is the syntax −public static bool IsLower (char ch);Above, the parameter ch is the Unicode character to evaluate.ExampleLet us now see an example to implement the Char.IsLower() method −using System; public class Demo {    public static void Main(){       bool res;       char val = 'K';       Console.WriteLine("Value = "+val);       res = Char.IsLower(val);       Console.WriteLine("Is the value a lowercase letter? = "+res);    } }OutputThis will produce the ... Read More

Char.IsLetterOrDigit() Method in C#

AmitDiwan
Updated on 12-Nov-2019 10:23:35

547 Views

The Char.IsLetterOrDigit() method in C# indicates whether the specified Unicode character is categorized as a letter or a decimal digit.SyntaxFollowing is the syntax −public static bool IsLetterOrDigit (char ch);Above, ch is the Unicode character to evaluate.ExampleLet us now see an example to implement the Char.IsLetterOrDigit() method −using System; public class Demo {    public static void Main(){       bool res;       char val = '1';       Console.WriteLine("Value = "+val);       res = Char.IsLetterOrDigit(val);       Console.WriteLine("Is the value a letter or digit? = "+res);    } }OutputThis will produce the following ... Read More

MathF.Atanh() Method in C# with Examples

AmitDiwan
Updated on 12-Nov-2019 10:21:29

44 Views

The MathF.Atanh() method in C# returns the hyperbolic arc-tangent of a floating-point value.SyntaxFollowing is the syntax −public static float Atanh (float val);ExampleLet us now see an example to implement the MathF.Atanh() method −using System; public class Demo {    public static void Main(){       float val1 = 25f;       float val2 = 15f;       Console.WriteLine("Return value (val1) = "+(MathF.Atanh(val1)));       Console.WriteLine("Return value (val2) = "+(MathF.Atanh(val2)));    } }OutputThis will produce the following output −Return value (val1) = NaN Return value (val2) = NaNExampleLet us now see another example to implement the MathF.Atanh() ... Read More

UInt16.ToString Method in C# with Examples

AmitDiwan
Updated on 12-Nov-2019 09:57:26

102 Views

The UInt16.ToString() method in C# is used to convert the numeric value of the current UInt16 instance to its equivalent string representation.SyntaxFollowing is the syntax −public override string ToString();ExampleLet us now see an example to implement the UInt16.ToString() method −using System; public class Demo {    public static void Main(){       ushort val1 = 100;       ushort val2 = 80;       Console.WriteLine("Value1 (String representation) = "+val1.ToString());       Console.WriteLine("Value2 (String representation) = "+val2.ToString());       bool res = val1.Equals(val2);       Console.WriteLine("Return value (comparison) = "+res);       if (res) ... Read More

UInt16.MinValue Field in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:42:02

85 Views

The UInt16.MinValue field in C# represents the minimum possible value of the 16-bit unsigned integer.SyntaxFollowing is the syntax −public const ushort MinValue = 0;ExampleLet us now see an example to implement the UInt16.MinValue field −using System; public class Demo {    public static void Main(){       ushort val1 = 23;       ushort val2 = 0;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("HashCode for value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for value2 = "+val2.GetHashCode());       Console.WriteLine("Are they equal? = "+(val1.Equals(val2)));       TypeCode type1 ... Read More

MathF.Sign() Method in C# with Examples

AmitDiwan
Updated on 12-Nov-2019 09:53:33

216 Views

The MathF.Sign() method in C# returns an integer specifying the sign of the number.SyntaxFollowing is the syntax −public static int Sign (float val);Above, Val is the floating-point number whose sign is to be calculated.The return value is 0 if Val is zero. It’s -1 if the value is less than zero and 1 if the value is greater than zero.ExampleLet us now see an example to implement the MathF.Sign() method −using System; public class Demo {    public static void Main(){       float val1 = 10.23898f;       float val2 = -20.878788f;       Console.WriteLine("MathF.Sign(val1) = ... Read More

MathF.Round() Method in C# with Examples

AmitDiwan
Updated on 12-Nov-2019 09:52:10

2K+ Views

The MathF.Round() method in C# is used to round a value to the nearest integer or to the particular number of fractional digits.SyntaxFollowing is the syntax −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);ExampleLet us now see an example to implement the MathF.Round() method −using System; public class Demo {    public static void Main(){       float val1 = 15.20f;       float val2 = 3.10f;       Console.WriteLine("Rounded (val1) = "+MathF.Round(val1)); ... Read More

Advertisements