
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
Found 2587 Articles for Csharp

4K+ Views
The Char.CompareTo() method in C# is used to compare this instance to a specified object or value type, and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified object or value type.SyntaxFollowing is the syntax −public int CompareTo (char val); public int CompareTo (object val);Above, Val for the 1st syntax is a char object to compare, whereas for the 2nd syntax it is an object to compare this instance to or null.The return value is zero if the current instance has the same position in the sort order as Val. ... Read More

71 Views
The Byte.ToString() method in C# converts the value of the current Byte object to its equivalent string representation.SyntaxFollowing is the syntax −public override string ToString ();ExampleLet us now see an example to implement the Byte.ToString() method −using System; public class Demo { public static void Main(){ byte val1, val2; val1 = Byte.MinValue; val2 = 15; Console.WriteLine("Value1 (Byte) = "+val1.ToString()); Console.WriteLine("Value2 (Byte) = "+val2.ToString()); } }OutputThis will produce the following output −Value1 (Byte) = 0 Value2 (Byte) = 15

92 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

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

70 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

77 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

398 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

110 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

117 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