找到 34423 篇文章 关于编程

如何在 C# 中更改控制台的 CursorSize?

AmitDiwan
更新于 2019年11月13日 07:01:33

161 次浏览

要更改 C# 中控制台的 CursorSize,请使用 C# 中的 Console.CursorSize 属性。示例让我们来看一个示例 -using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("背景颜色已更改 = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("前景色已更改 = "+Console.ForegroundColor);       Console.CursorSize = 1;       Console.WriteLine("CursorSize = "+Console.CursorSize);    } }输出这将产生以下输出 -

如何在 C# 中更改控制台的 CursorLeft?

AmitDiwan
更新于 2019年11月13日 07:00:13

254 次浏览

要更改 C# 中控制台的 CursorLeft,请使用 Console.CursorLeft 属性。示例让我们来看一个示例 -using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("背景颜色已更改 = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("前景色已更改 = "+Console.ForegroundColor);       Console.CursorLeft = 30;       Console.Write("CursorLeft 位置: "+Console.CursorLeft);    } }输出这将产生以下输出 -

如何在 C# 控制台中更改文本的前景色?

AmitDiwan
更新于 2019年11月13日 06:58:27

9K+ 次浏览

要更改文本的前景色,请在 C# 中使用 Console.ForegroundColor 属性。示例让我们来看一个示例 -using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("背景颜色已更改 = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("前景色已更改 = "+Console.ForegroundColor);    } }输出这将产生以下输出 -

如何在 C# 中更改控制台的 BufferWidth?

AmitDiwan
更新于 2019年11月13日 06:56:55

133 次浏览

要更改控制台的 BufferWidth,请使用 Console.BufferWidth 属性。示例现在让我们来看一个示例 -using System; class Demo {    public static void Main (string[] args){       Console.BufferHeight = 200;       Console.WriteLine("缓冲区高度 = "+Console.BufferHeight);       Console.BufferHeight = 250;       Console.WriteLine("缓冲区宽度 = "+Console.BufferWidth);    } }输出这将产生以下输出 -缓冲区高度 = 200 缓冲区宽度 = 200

C# 中的 Char.IsLetter() 方法

AmitDiwan
更新于 2019年11月13日 06:54:36

2K+ 次浏览

C# 中的 Char.IsLetter() 方法用于指示指定的 Unicode 字符是否归类为 Unicode 字母。语法以下是语法 -public static bool IsLetter (char ch);上面,参数 ch 是要评估的 Unicode 字符。示例现在让我们来看一个实现 Char.IsLetter() 方法的示例 -using System; public class Demo {    public static void Main(){       bool res;       char val = 'K';       Console.WriteLine("值 = "+val);       res = Char.IsLetter(val);       Console.WriteLine("该值是否为字母? = "+res);    } }输出这将产生以下... 阅读更多

C# 中的 Char.IsHighSurrogate(String, Int32) 方法

AmitDiwan
更新于 2019年11月13日 06:52:59

115 次浏览

C# 中的 Char.IsHighSurrogate() 方法指示字符串中指定位置处的 Char 对象是否为高代理项。语法以下是语法 -public static bool IsHighSurrogate (string str, int index);上面,str 是一个字符串,而 index 是 str 中要评估的字符的位置。示例现在让我们来看一个实现 Char.IsHighSurrogate() 方法的示例 -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)   ... 阅读更多

C# 中的 Char.IsDigit() 方法

AmitDiwan
更新于 2019年11月13日 06:51:02

2K+ 次浏览

C# 中的 Char.IsDigit() 方法指示指定的 Unicode 字符是否归类为十进制数字。语法以下是语法 -public static bool IsDigit (char ch);上面,参数 ch 是要评估的 Unicode 字符。示例现在让我们来看一个实现 Char.IsDigit() 方法的示例 -using System; public class Demo {    public static void Main(){       bool res;       char val = 'g';       Console.WriteLine("值 = "+val);       res = Char.IsDigit(val);       Console.WriteLine("该值是否为数字? = "+res);    } }输出这将产生以下输出 -值 = ... 阅读更多

C# 中的 MathF.Atan() 方法及示例

AmitDiwan
更新于 2019年11月13日 06:49:46

59 次浏览

C# 中的 MathF.Atan() 方法用于返回正切值为浮点值参数的角。语法以下是语法 -public static float Atan (float val);上面,Val 是浮点值。示例现在让我们来看一个实现 MathF.Atan() 方法的示例 -using System; public class Demo {    public static void Main(){       float val1 = 1.2f;       float val2 = 45.5f;       Console.WriteLine("角度 (val1) = "+(MathF.Atan(val1)));       Console.WriteLine("角度 (val2) = "+(MathF.Atan(val2)));    } }输出这将产生以下输出 -角度 (val1) = 0.876058 角度 (val2) = 1.548822示例现在让我们... 阅读更多

C# 中的 MathF.Asinh() 方法及示例

AmitDiwan
更新于 2019年11月13日 06:47:08

69 次浏览

C# 中的 MathF.Asinh() 方法用于返回浮点值的双曲反正弦。语法以下是语法 -public static float Asinh (float val);示例现在让我们来看一个实现 MathF.Asinh() 方法的示例 -using System; public class Demo {    public static void Main(){       float val1 = 1.2f;       float val2 = 45.5f;       Console.WriteLine("角度 (val1) = "+(MathF.Asinh(val1)));       Console.WriteLine("角度 (val2) = "+(MathF.Asinh(val2)));    } }输出这将产生以下输出 -角度 (val1) = 1.015973 角度 (val2) = 4.51098示例现在让我们来看另一个实现 MathF.Asinh() 方法的示例... 阅读更多

C# 中的 MathF.Asin() 方法及示例

AmitDiwan
更新于 2019年11月13日 06:44:07

56 次浏览

C# 中的 MathF.Asin() 方法用于返回正弦值为浮点值参数的角。语法以下是语法 -public static float Asin (float val);上面,Val 是浮点值。示例现在让我们来看一个实现 MathF.Asin() 方法的示例 -using System; public class Demo {    public static void Main(){       float val1 = 0.1f;       float val2 = 8.9f;       Console.WriteLine("角度 (val1) = "+(MathF.Asin(val1)));       Console.WriteLine("角度 (val2) = "+(MathF.Asin(val2)));    } }输出这将产生以下输出 -角度 (val1) = 0.1001674 角度 (val2) = NaN示例现在让我们... 阅读更多

广告

© . All rights reserved.