Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2329 of 3366
231 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
75 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
81 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
405 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
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
116 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
121 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
120 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
627 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
135 Views
The BitConverter.ToBoolean() method in C# returns a Boolean value converted from the byte at a specified position in a byte array.SyntaxFollowing is the syntax −public static bool ToBoolean (byte[] arr, int startIndex);Above, arr is a byte array, whereas startIndex is the index of the byte within a value.ExampleLet us now see an example to implement the BitConverter.ToBoolean() method −using System; public class Demo { public static void Main(){ byte[] arr = { 50, 100 }; Console.WriteLine("Array values..."); for (int i = 0; i < arr.Length; i++) { ... Read More