我有两个用户定义的函数(WriteFunction)和(ReadFunction),第二个函数(ReadFunction)有错误,即当前上下文中不存在关键字。(在姓名、ID、年龄、电子邮件下划线。)
这是完整的代码:
//First Function
public static void WriteFunction()
{
int count = 0;
while (count < 10)
{
Console.Write(" Enter your Name: ");
string Name = Console.ReadLine();
Console.Write(" Enter your ID: ");
int ID = int.Parse(Console.ReadLine());
Console.Write(" Enter your Age: ");
int Age = int.Parse(Console.ReadLine());
Console.Write(" Enter your E-mail: ");
string Email = Console.ReadLine();
count++;
}
}
//Second Function
public static void ReadFunction()
{
string output = string.Format("Thank you for registration! Your Submitted information are:" + Environment.NewLine + "Name: {0}"
+ Environment.NewLine + "ID: {1}" + Environment.NewLine + "Age: {2}" + Environment.NewLine + "E-mail: {3}", Name, ID, Age, Email);
// I using the Environment.NewLine to insert new lines
Console.WriteLine(output);
}
等待您的答复。谢谢。