C#如何让应用程序接收我的输入

C#如何让应用程序接收我的输入,c#,C#,我曾尝试在C#中执行一个简单的控制台应用程序,在其中输入一个值,以便在控制台中打印出相同数量的星星。例如,如果我在控制台中输入值5,我希望它打印出5颗星:**** 1=>* 2=>** 3=>*** 编辑: enter using System; 使用System.Collections.Generic 使用System.Linq 使用System.Text 使用System.Threading.Tasks 命名空间kvadrat { 班级计划 { 静态void Main(字符串[]参数)

我曾尝试在C#中执行一个简单的控制台应用程序,在其中输入一个值,以便在控制台中打印出相同数量的星星。例如,如果我在控制台中输入值5,我希望它打印出5颗星:****

1=>*

2=>**

3=>***

编辑:

enter using System; 
使用System.Collections.Generic
使用System.Linq
使用System.Text
使用System.Threading.Tasks
命名空间kvadrat
{
班级计划
{
静态void Main(字符串[]参数)

{
控制台。写下(“你在哪里?”;
int size=Convert.ToInt32(Console.ReadLine());
对于(int y=0;y

}

这将复制您所拥有的。这个问题不清楚你还需要什么

string input = Console.ReadLine();
int intValue;
if (int.TryParse(input, out intValue))
{
    Console.WriteLine(new string('*', intValue));
}

我的问题得到了答案

        {
        Console.Write("Hur stor kvadrat vill du ha? ");
        int size = Convert.ToInt32(Console.ReadLine());

        for (int y = 0; y < size; y++)
        {
            for (int x = 0; x < size; x++)
            {
                Console.Write("*");
            }
            Console.WriteLine("");
        }
        Console.ReadKey();
    } code here
{
控制台。写下(“你在哪里?”;
int size=Convert.ToInt32(Console.ReadLine());
对于(int y=0;y
我猜问题更多的是“我如何使应用程序接收我的输入”,而不是“我如何更改我所做的非常具体的打印”是的,我做了。我没有找到我想要的答案。我在寻找一种方法,用户可以在控制台中输入一个数字,并在控制台中打印出相同数量的星星。
        {
        Console.Write("Hur stor kvadrat vill du ha? ");
        int size = Convert.ToInt32(Console.ReadLine());

        for (int y = 0; y < size; y++)
        {
            for (int x = 0; x < size; x++)
            {
                Console.Write("*");
            }
            Console.WriteLine("");
        }
        Console.ReadKey();
    } code here