方法}预期

use*_*750 -1 c# methods

得到以下代码给出'} expected'的第一个错误

只是想获取并打印学生数据.不确定我是否需要使这些方法像返回类型或其他东西.欢迎任何建议,谢谢.

namespace studentInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            getUserInformation();
            printStudentDetails(string firstName, string lastName, string birthday);
        }

        static void getUserInformation()
        {
            Console.WriteLine("Enter the student's first name: ");
            string firstName = Console.ReadLine();
            Console.WriteLine("Enter the student's last name");
            string lastName = Console.ReadLine();
            Console.WriteLine("Enter your bithdate");
            //DateTime birthdate = Convert.ToDateTime(Console.ReadLine());
            string birthday = Console.ReadLine();

        }

        static void printStudentDetails(string firstName, string lastName, string birthday)
        {
            Console.WriteLine("{0} {1} was born on: {2}", firstName, lastName, birthday);
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

apo*_*ene 5

你正在调用一个方法:

 printStudentDetails(string firstName, string lastName, string birthday);
Run Code Online (Sandbox Code Playgroud)

应该:

 printStudentDetails(firstName, lastName, birthday);
Run Code Online (Sandbox Code Playgroud)

在将它们传递给方法之前,您还必须定义vars,firstName,lastName,birthday.