- 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
347 Views
The Console.KeyAvailable() property in C# is used to get a value indicating whether a key press is available in the input stream.SyntaxThe syntax is as follows −public static bool KeyAvailable { get; }ExampleLet us now see an example to implement the Console.KeyAvailable() property in C# −using System; using System.Threading; class Demo { public static void Main (string[] args) { ConsoleKeyInfo cs = new ConsoleKeyInfo(); do { Console.WriteLine("Press a key to display; "+ "press the 'Q' key to quit."); while (Console.KeyAvailable == false)Thread.Sleep(100); ... Read More
1K+ Views
The Console class in C# is used to represent the standard input, output, and error streams for console applications.Let us see some examples of Console class properties in C# −Console.CursorLeft propertyTo change the CursorLeft of the Console in C#, use the Console.CursorLeft property.ExampleLet us see an example −using System; class Demo { public static void Main (string[] args) { Console.BackgroundColor = ConsoleColor.Blue; Console.WriteLine("Background color changed = "+Console.BackgroundColor); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Foreground color changed = "+Console.ForegroundColor); Console.CursorLeft = 30; Console.Write("CursorLeft position: "+Console.CursorLeft); ... Read More
308 Views
The Decimal Struct in C# Represents a decimal floating-point number. The Decimal value type represents decimal numbers ranging from positive 79, 228, 162, 514, 264, 337, 593, 543, 950, 335 to negative 79, 228, 162, 514, 264, 337, 593, 543, 950, 335. The default value of a Decimal is 0.Let us now see some examples of the methods in Decimal Struct −Decimal.Add()The Decimal.Add() method in C# is used to add two specified Decimal values.SyntaxFollowing is the syntax −public static decimal Add (decimal val1, decimal val2);Above, va1 is the first decimal to add, whereas val2 is the second decimal to be ... Read More
339 Views
The UInt64 struct represents a 64-bit unsigned integer. The UInt64 value type represents unsigned integers with values ranging from 0 to 18, 446, 744, 073, 709, 551, 615.Let us now see some examples of UInt64 Struct methods −UInt64.CompareTo()The UInt64.CompareTo() method in C# is used to compare the current instance to a specified object or UInt64 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (object val); public int CompareTo (ulong 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 ... Read More
32 Views
The Uri.IsWellFormedOriginalString() method in C# indicates whether the string used to construct this Uri was well-formed and is not required to be further escaped.SyntaxFollowing is the syntax −public bool IsWellFormedOriginalString ();ExampleLet us now see an example to implement the Uri.IsWellFormedOriginalString() method −using System; public class Demo { public static void Main(){ Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm"); Console.WriteLine("URI = "+newURI1); Uri newURI2 = new Uri("https://www.qries.com/"); Console.WriteLine("URI = "+newURI2); if(newURI1.Equals(newURI2)) Console.WriteLine("Both the URIs are equal!"); else ... Read More
24 Views
The Uri.IsHexEncoding() method in C# determines whether a character in a string is hexadecimal encoded.SyntaxFollowing is the syntax −public static bool IsHexEncoding (string pattern, int index);Above, the pattern parameter is the string to check, whereas the index is the location in pattern to check for hexadecimal encoding.ExampleLet us now see an example to implement the Uri.IsHexEncoding() method −using System; public class Demo { public static void Main(){ string pattern = "%50"; bool res = Uri.IsHexEncoding(pattern, 0); if (res) Console.WriteLine("Valid: Hexadecimal Encoded"); else ... Read More
103 Views
The Uri.IsBaseOf() method in C# is used to determine whether the current Uri instance is a base of the specified Uri instance.SyntaxFollowing is the syntax −public bool IsBaseOf (Uri uri);Above, the parameter Uri is the specified Uri instance to test.ExampleLet us now see an example to implement the Uri.IsBaseOf() method −using System; public class Demo { public static void Main(){ Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm"); Console.WriteLine("URI = "+newURI1); Uri newURI2 = new Uri("https://www.tutorialspoint.com/"); Console.WriteLine("URI = "+newURI2); if(newURI1.Equals(newURI2)) Console.WriteLine("Both the URIs ... Read More
239 Views
The MathF.Ceiling() method in C# is used to find the smallest integer greater than or equal to the float value in the argument.SyntaxFollowing is the syntax −public static float Ceiling (float val);Above, Val is the floating-point value.ExampleLet us now see an example to implement the MathF.Ceiling() method −using System; class Demo { public static void Main(){ float val1 = 12.67f; float val2 = 30.13f; Console.WriteLine("Ceiling (value1) = "+MathF.Ceiling(val1)); Console.WriteLine("Ceiling (value2) = "+MathF.Ceiling(val2)); } }OutputThis will produce the following output −Ceiling (value1) = 13 Ceiling (value2) = ... Read More
47 Views
The MathF.Cbrt() method in C# is used to return the cube root of a floating-point value.SyntaxFollowing is the syntax −public static float Cbrt (float val);ExampleLet us now see an example to implement the MathF.Cbrt() method −using System; class Demo { public static void Main(){ float val1 = 64f; Console.WriteLine("Cube root = "+MathF.Cbrt(val1)); } }OutputThis will produce the following output −Cube root = 4ExampleLet us now see another example to implement the MathF.Cbrt() method −using System; class Demo { public static void Main(){ float val1 = 12.67f; ... Read More
223 Views
The Char.IsNumber() method in C# is used to indicate whether the specified Unicode character is categorized as a number.SyntaxFollowing is the syntax −public static bool IsNumber (char ch);Above, the parameter ch is the Unicode character to evaluate.ExampleLet us now see an example to implement the Char.IsNumber() method −using System; public class Demo { public static void Main(){ bool res; char val = '2'; Console.WriteLine("Value = "+val); res = Char.IsNumber(val); Console.WriteLine("Is the value a number? = "+res); } }OutputThis will produce the following output ... Read More