你可以设置一个变量为console.ReadLIne()?(Can you set a variable to console.ReadLIne()?)

我是新手编程的人。 这是我一直在思考的问题。 你可以在c#中设置一个变量为Console.ReadLine(),然后调用变量而不是每次输入Console.ReadLine()。 例如:

//Set Variable var read = Console.ReadLine(); //Call vaariable read;

I am new to programming here. This is a question that i have been mulling over. Can you set a variable to Console.ReadLine() in c# and then call the variable instead of typing Console.ReadLine() everytime? For example:

//Set Variable var read = Console.ReadLine(); //Call vaariable read;

最满意答案

喜欢这个:

//Set Variable Func<string> read = Console.ReadLine; //Call vaariable read();

Like this:

//Set Variable Func<string> read = Console.ReadLine; //Call vaariable read();你可以设置一个变量为console.ReadLIne()?(Can you set a variable to console.ReadLIne()?)

我是新手编程的人。 这是我一直在思考的问题。 你可以在c#中设置一个变量为Console.ReadLine(),然后调用变量而不是每次输入Console.ReadLine()。 例如:

//Set Variable var read = Console.ReadLine(); //Call vaariable read;

I am new to programming here. This is a question that i have been mulling over. Can you set a variable to Console.ReadLine() in c# and then call the variable instead of typing Console.ReadLine() everytime? For example:

//Set Variable var read = Console.ReadLine(); //Call vaariable read;

最满意答案

喜欢这个:

//Set Variable Func<string> read = Console.ReadLine; //Call vaariable read();

Like this:

//Set Variable Func<string> read = Console.ReadLine; //Call vaariable read();