
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

534 Views
The UInt16 struct represents a 16-bit unsigned integer. The UInt16 value type represents unsigned integers with values ranging from 0 to 65535.Let us now see some examples of UInt16 Struct methods −UInt16.CompareTo()The UInt16.CompareTo() method in C# is used to compare the current instance to a specified object or UInt16 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (object val); public int CompareTo (ushort val;Above, the value for the 1st syntax is an object to compare. The value for 2nd syntax is an unsigned integer to compare.The return value is 0 if the current instance ... Read More

1K+ Views
The Match class has static methods and constants for trigonometric, logarithmic and other mathematical functions.The Math class in C# has Math.E and Math.PI fields. Let us see an example of both the fields −Math.EIt is the natural logarithmic base specified by the constant e.SyntaxThe syntax is as follows −public const double E = 2.71828182845905;ExampleLet us now see an example −using System; public class Demo{ public static void Main(){ double d = Math.E; Console.WriteLine("Math.E = " + d); } }OutputThis will produce the following output −Math.E = 2.71828182845905Math.PIThe Math.PI field represents the ratio ... Read More

66 Views
The Uri.GetHashCode() method in C# gets the hash code for the URI.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the Uri.GetHashCode() method −using System; public class Demo { public static void Main(){ string URI1 = "https://www.tutorialspoint.com/index.htm"; Console.WriteLine("URI = "+URI1); string URI2 = "https://www.tutorialspoint.com/"; Console.WriteLine("URI = "+URI2); Console.WriteLine("Escaped string (URI1) = "+Uri.EscapeDataString(URI1)); Console.WriteLine("Escaped string (URI2) = "+Uri.EscapeDataString(URI2)); Console.WriteLine("GetHashCode() for URI1 = "+URI1.GetHashCode()); Console.WriteLine("GetHashCode() for URI2 = "+URI2.GetHashCode()); ... Read More

68 Views
The Uri.FromHex() method in C# is used to get the decimal value of a hexadecimal digit.SyntaxFollowing is the syntax −public static int FromHex (char digit);Above, the parameter digit is the hexadecimal digit (0-9, a-f, A-F) to convert.ExampleLet us now see an example to implement the Uri.FromHex() method −using System; public class Demo { public static void Main(){ char ch = 'D'; Console.WriteLine("Character value = "+ch); int res = Uri.FromHex(ch); Console.WriteLine("Converted int value = "+res); } }OutputThis will produce the following output −Character value = D Result ... Read More

1K+ Views
The Uri.EscapeDataString() method in C# converts a string to its escaped representation.SyntaxFollowing is the syntax −public static string EscapeDataString (string str);Above, the string str is the string to escape.ExampleLet us now see an example to implement the Uri.EscapeDataString() method −using System; public class Demo { public static void Main(){ string URI1 = "https://www.tutorialspoint.com/index.htm"; Console.WriteLine("URI = "+URI1); string URI2 = "https://www.tutorialspoint.com/"; Console.WriteLine("URI = "+URI2); Console.WriteLine("Escaped string (URI1) = "+Uri.EscapeDataString(URI1)); Console.WriteLine("Escaped string (URI2) = "+Uri.EscapeDataString(URI2)); } }OutputThis will produce the following output ... Read More

2K+ Views
The UInt32.ToString() method in C# is used to convert the numeric value of the current UInt32 instance to its equivalent string representation.SyntaxFollowing is the syntax −public override string ToString();ExampleLet us now see an example to implement the UInt32.ToString() method −using System; public class Demo { public static void Main(){ uint val1 = 100; uint 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

194 Views
The UInt32.MinValue field in C# represents the minimum value of the 32-bit unsigned integer.SyntaxFollowing is the syntax −public const uint MinValue = 0;ExampleLet us now see an example to implement the UInt32.MinValue field −using System; public class Demo { public static void Main(){ uint val1 = 23; uint 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

305 Views
The UInt32.MaxValue field in C# represents the maximum value of the 32-bit unsigned integer.SyntaxFollowing is the syntax −public const uint MaxValue = 4294967295;ExampleLet us now see an example to implement the UInt32.MaxValue field −using System; public class Demo { public static void Main(){ uint val1 = 23; uint 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

110 Views
The UInt32.GetTypeCode() method in C# is used to return the TypeCode for value type UInt32.SyntaxFollowing is the syntax −public TypeCode GetTypeCode ();ExampleLet us now see an example to implement the UInt32.GetTypeCode() method −using System; public class Demo { public static void Main(){ uint val1 = 55; uint val2 = 100; TypeCode type1 = val1.GetTypeCode(); TypeCode type2 = val2.GetTypeCode(); Console.WriteLine("Typecode for val1 = "+type1); Console.WriteLine("Typecode for val2 = "+type2); } }OutputThis will produce the following output −Typecode for val1 = UInt32 ... Read More

140 Views
The Math class in C# has Math.E and Math.PI fields. Let us see an example of both the fields −Math.ESyntaxIt is the natural logarithmic base specified by the constant e. The syntax is as follows −public const double E = 2.71828182845905;ExampleLet us now see an example −using System; public class Demo{ public static void Main(){ double d = Math.E; Console.WriteLine("Math.E = " + d); } }OutputThis will produce the following output −Math.E = 2.71828182845905Math.PIThe Math.PI field represents the ratio of the circumference of a circle to its diameter, specified by the constant, ... Read More