我对C#很新,并试图在这里调用一个带有多个控制台输入的静态void方法:
static void CustomerInfo()
{
Console.WriteLine("Custom First Name: ");
string firstName = Console.ReadLine();
Console.WriteLine("Customer Last Name: ");
string lastName = Console.ReadLine();
Console.WriteLine("Customer Address: ");
string address = Console.ReadLine();
}
static void PrintCustomerDetails(string first, string last, string
address)
{
Console.WriteLine("{0} {1} address is: {2}", first, last, address);
}
这应该返回所有必需的CustomerInfo,但我只是在控制台上输入Firt Name作为输入。请帮忙。提前谢谢。
答案 0 :(得分:0)
像这样打电话给你的方法 PrintCustomerDetails
static void CustomerInfo()
{
Console.WriteLine("Custom First Name: ");
string firstName = Console.ReadLine();
Console.WriteLine("Customer Last Name: ");
string lastName = Console.ReadLine();
Console.WriteLine("Customer Address: ");
string address = Console.ReadLine();
PrintCustomerDetails(firstName, lastName, address);
}