Found 2587 Articles for Csharp

Uri.IsHexEncoding() Method in C#

AmitDiwan
Updated on 14-Nov-2019 05:24:17

74 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

Uri.IsBaseOf(Uri) Method in C#

AmitDiwan
Updated on 13-Nov-2019 07:08:36

163 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

MathF.Ceiling() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:06:30

377 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

MathF.Cbrt() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:05:14

98 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

Char.IsNumber() Method in C#

AmitDiwan
Updated on 13-Nov-2019 07:04:02

374 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

MathF.Pow() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 07:02:54

247 Views

The MathF.Pow() method in C# is used to compute a number raise to the power of another number.SyntaxFollowing is the syntax −public static float Pow (float val1, float val2);Above, val1 is the floating-point number raised to a power. The val2 parameter is the power or exponent.ExampleLet us now see an example to implement the MathF.Pow() method −using System; public class Demo {    public static void Main(){       float val1 = 5.00f;       float val2 = 3.00f;       Console.WriteLine("MathF.Pow() = "+MathF.Pow(val1, val2));    } }OutputThis will produce the following output −MathF.Pow() = 125ExampleLet us ... Read More

How to change the CursorSize of the Console in C#?

AmitDiwan
Updated on 13-Nov-2019 07:01:33

219 Views

To change the CursorSize of the Console in C#, use the Console.CursorSize property in C#.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.CursorSize = 1;       Console.WriteLine("CursorSize = "+Console.CursorSize);    } }OutputThis will produce the following output −

How to change the CursorLeft of the Console in C#?

AmitDiwan
Updated on 13-Nov-2019 07:00:13

311 Views

To 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);    } }OutputThis will produce the following output −

How to change the Foreground Color of Text in C# Console?

AmitDiwan
Updated on 13-Nov-2019 06:58:27

10K+ Views

To change the Foreground Color of text, use the Console.ForegroundColor property in C#.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);    } }OutputThis will produce the following output −

How to change BufferWidth of the Console in C#?

AmitDiwan
Updated on 13-Nov-2019 06:56:55

181 Views

To change the BufferWidth of the Console, use the Console.BufferWidth property.ExampleLet us now see an example −using System; class Demo {    public static void Main (string[] args){       Console.BufferHeight = 200;       Console.WriteLine("Buffer Height = "+Console.BufferHeight);       Console.BufferHeight = 250;       Console.WriteLine("Buffer Width = "+Console.BufferWidth);    } }OutputThis will produce the following output −Buffer Height = 200 Buffer Width = 200

Advertisements