Found 26504 Articles for Server Side Programming

Byte.MinValue Field in C#

AmitDiwan
Updated on 08-Nov-2019 11:02:02

95 Views

The Byte.MinValue field in C# is used to represent the smallest possible value of a Byte.SyntaxFollowing is the syntax −public const byte MinValue = 0;ExampleLet us now see an example to implement the Byte.MinValue method −using System; public class Demo {    public static void Main(){       byte val;       val = Byte.MinValue;       Console.WriteLine("Minimum Value (Byte) = "+val);    } }OutputThis will produce the following output −Minimum Value (Byte) = 0

Byte.MaxValue Field in C#

AmitDiwan
Updated on 08-Nov-2019 11:00:30

228 Views

The Byte.MaxValue field in C# is used to represent the largest possible value of a Byte.SyntaxFollowing is the syntax −public const byte MaxValue = 255;ExampleLet us now see an example to implement the Byte.MaxValue field −using System; public class Demo {    public static void Main(){       byte val;       val = Byte.MaxValue;       Console.WriteLine("Maximum Value (Byte) = "+val);    } }OutputThis will produce the following output −Maximum Value (Byte) = 255

Byte.GetTypeCode() Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:59:35

71 Views

The Byte.GetTypeCode() method in C# returns the TypeCode for value type Byte.SyntaxFollowing is the syntax −public TypeCode GetTypeCode ();ExampleLet us now see an example to implement the Byte.GetTypeCode() method −using System; public class Demo {    public static void Main(){       byte val1;       val1 = 50;       TypeCode type = val1.GetTypeCode();       Console.WriteLine("TypeCode = "+type);    } }OutputThis will produce the following output −TypeCode = Byte

Math.Cosh() Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:58:09

78 Views

The Math.Cosh() method in C# is used to return the hyperbolic cosine of the angle specified as a parameter.SyntaxFollowing is the syntax −public static double Cosh (double val);Above, Val is an angle.ExampleLet us now see an example to implement Math.Cosh() method −using System; public class Demo {    public static void Main(){       double val1 = 30.0;       double val2 = 45.0;       Console.WriteLine(Math.Cosh(val1));       Console.WriteLine(Math.Cosh(val2));    } }OutputThis will produce the following output −5343237290762.23 1.74671355287425E+19ExampleLet us see another example to implement Math.Cosh() method −using System; public class Demo {    public ... Read More

Math.Cos() Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:56:45

401 Views

The Math.Cos() method in C# is used to return the cosine of the angle set as a parameter.SyntaxFollowing is the syntax −public static double Cos (double val);Above, Val is the angle.ExampleLet us now see an example to implement Math.Cos() method −using System; public class Demo {    public static void Main(){       double val1 = 30.0;       Console.WriteLine(Math.Cos( (val1 * (Math.PI)) / 180 ));    } }OutputThis will produce the following output −0.866025403784439ExampleLet us see another example to implement Math.Cos() method −using System; public class Demo {    public static void Main(){       double ... Read More

Math.Ceiling() Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:54:17

4K+ Views

The Math.Ceiling() method in C# is used to return the smallest integral value greater than or equal to the specified number.SyntaxFollowing is the syntax −public static decimal Ceiling (decimal val); public static double Ceiling(double val)For the first syntax above, the value Val is the decimal number, whereas Val in the second syntax is the double number.ExampleLet us now see an example to implement Math.Ceiling() method −using System; public class Demo {    public static void Main(){       decimal val1 = 9.99M;       decimal val2 = -5.10M;       Console.WriteLine("Result = " + Math.Ceiling(val1));     ... Read More

Byte.GetHashCode() Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:52:32

111 Views

The Byte.GetHashCode() method in C# is used to return the hash code for the current instance.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the Byte.GetHashCode() method −using System; public class Demo {    public static void Main(){       long val = 5654665;       byte[] arr = BitConverter.GetBytes(val);       for (int i = 0; i < arr.Length; i++) {          int res = arr[i].GetHashCode();          Console.WriteLine("Hashcode = "+res);       }    } }OutputThis will produce the following output −Hashcode = 137 Hashcode = 72 Hashcode = 86 Hashcode = 0 Hashcode = 0 Hashcode = 0 Hashcode = 0 Hashcode = 0

Byte.Equals(Object) Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:50:07

118 Views

The Byte.Equals(Object) method in C# returns a value indicating whether this instance is equal to a specified object.SyntaxFollowing is the syntax −public override bool Equals (object ob);Above, ob is an object to compare with this instance or null.ExampleLet us now see an example to implement the Byte.Equals(Object) method −using System; public class Demo {    public static void Main(){       byte b1;       b1 = 5;       object b2 = 5/10;       if (b1.Equals(b2))          Console.Write("b1 = b2");       else          Console.Write("b1 is not equal to b2");    } }OutputThis will produce the following output −b1 is not equal to b2

Boolean.CompareTo(Object) Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:48:27

114 Views

The Boolean.CompareTo(Object) method in C# compares this instance to a specified object and returns an integer that indicates their relationship to one another.SyntaxFollowing is the syntax −public int CompareTo (object ob);Above, the parameter ob is an object to compare to this instance, or null.ExampleLet us now see an example to implement the Boolean.CompareTo(Object) method −using System; public class Demo {    public static void Main(){       bool b1 = false;       object b2 = false;       int res = b1.CompareTo(b2);       if (res > 0)          Console.Write("b1 > b2"); ... Read More

Boolean.CompareTo(Boolean) Method in C#

AmitDiwan
Updated on 08-Nov-2019 10:46:15

621 Views

The Boolean.CompareTo(Boolean) method in C# is used to compare this instance to a specified Boolean object and returns an integer that indicates their relationship to one another.SyntaxFollowing is the syntax −public int CompareTo (bool val);Above, Val is a Boolean object to compare to the current instance.ExampleLet us now see an example to implement the Boolean.CompareTo(Boolean) method −using System; public class Demo {    public static void Main(){       bool b1, b2;       b1 = false;       b2 = false;       int res = b2.CompareTo(b1);       if (res > 0)   ... Read More

Advertisements