Found 2628 Articles for Csharp

MathF.Pow() Method in C# with Examples

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

152 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

127 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

223 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

8K+ 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

118 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

Char.IsLetter() Method in C#

AmitDiwan
Updated on 13-Nov-2019 06:54:36

2K+ Views

The Char.IsLetter() method in C# is used to indicate whether the specified Unicode character is categorized as a Unicode letter.SyntaxFollowing is the syntax −public static bool IsLetter (char ch);Above, the parameter ch is the Unicode character to evaluate.ExampleLet us now see an example to implement the Char.IsLetter() method −using System; public class Demo {    public static void Main(){       bool res;       char val = 'K';       Console.WriteLine("Value = "+val);       res = Char.IsLetter(val);       Console.WriteLine("Is the value a letter? = "+res);    } }OutputThis will produce the following ... Read More

Char.IsHighSurrogate(String, Int32) Method in C#

AmitDiwan
Updated on 13-Nov-2019 06:52:59

101 Views

The Char.IsHighSurrogate() method in C# indicates whether the Char object at the specified position in a string is a high surrogate.SyntaxFollowing is the syntax −public static bool IsHighSurrogate (string str, int index);Above, str is a string, whereas the index is the position of the character to evaluate in str.ExampleLet us now see an example to implement the Char.IsHighSurrogate() method −using System; public class Demo {    public static void Main(){       string str = new String(new char[] { 'k', 'm', 'g', 't', '\uD800' });       bool res = Char.IsHighSurrogate(str, 4);       if (res)   ... Read More

Char.IsDigit() Method in C#

AmitDiwan
Updated on 13-Nov-2019 06:51:02

2K+ Views

The Char.IsDigit() method in C# indicates whether the specified Unicode character is categorized as a decimal digit.SyntaxFollowing is the syntax −public static bool IsDigit (char ch);Above, the parameter ch is the Unicode character to evaluate.ExampleLet us now see an example to implement the Char.IsDigit() method −using System; public class Demo {    public static void Main(){       bool res;       char val = 'g';       Console.WriteLine("Value = "+val);       res = Char.IsDigit(val);       Console.WriteLine("Is the value a digit? = "+res);    } }OutputThis will produce the following output −Value = ... Read More

MathF.Atan() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 06:49:46

53 Views

The MathF.Atan() method in C# is used to return the angle whose tangent is given as a float value argument.SyntaxFollowing is the syntax −public static float Atan (float val);Above, Val is the floating-point value.ExampleLet us now see an example to implement the MathF.Atan() method −using System; public class Demo {    public static void Main(){       float val1 = 1.2f;       float val2 = 45.5f;       Console.WriteLine("Angle (val1) = "+(MathF.Atan(val1)));       Console.WriteLine("Angle (val2) = "+(MathF.Atan(val2)));    } }OutputThis will produce the following output −Angle (val1) = 0.876058 Angle (val2) = 1.548822ExampleLet us ... Read More

MathF.Asinh() Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 06:47:08

62 Views

The MathF.Asinh() method in C# is used to return the hyperbolic arc-sine of a floating-point value.SyntaxFollowing is the syntax −public static float Asinh (float val);ExampleLet us now see an example to implement the MathF.Asinh() method −using System; public class Demo {    public static void Main(){       float val1 = 1.2f;       float val2 = 45.5f;       Console.WriteLine("Angle (val1) = "+(MathF.Asinh(val1)));       Console.WriteLine("Angle (val2) = "+(MathF.Asinh(val2)));    } }OutputThis will produce the following output −Angle (val1) = 1.015973 Angle (val2) = 4.51098ExampleLet us now see another example to implement the MathF.Asinh() method ... Read More

Advertisements