- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 2628 Articles for Csharp
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
31 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
37 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
318 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
79 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
76 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
65 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
528 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
63 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
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
The DateTime.IsLeapYear() method in C# is used to check whether the specified year is a leap year. The return value is a boolean, with TRUE if the year is a leap year, else FALSE.SyntaxFollowing is the syntax −public static bool IsLeapYear (int y);Above, y is the year to be checked, 2010, 2016, 2019, etc.ExampleLet us now see an example to implement the DateTime.IsLeapYear() method −using System; public class Demo { public static void Main() { int year = 2019; Console.WriteLine("Year = "+year); if (DateTime.IsLeapYear(year)){ Console.WriteLine("Leap Year!"); ... Read More