我正在尝试将此代码转换为 VB,但它给了我这个错误。
转换错误:无法转换代码。细节:
-- 第 1 行第 8 列:无效的 TypeDecl
请检查原始代码中的任何错误,然后重试。
public Exam GetExamByExamID(int ExamID)
{
Exam myExam = new Exam(0,"",0,"","");
for(Exam exam1 : ExamArray)
if(Exam.ExamID==ExamID)
{
myExam.ExamID = exam1.ExamID;
myExam.ExamTitle = exam1.ExamTitle;
myExam.CreditHours = exam1.CreditHours;
myExam.Description = exam1.Description;
myExam.PrerequisiteExam = exam1.PrerequisiteExam;
}
return myExam;
我将代码更改为此,但它仍然是相同的错误..
public Exam GetExamByExamID(int ExamID)
{
Exam myExam = new Exam(0,"",0,"","");
for(Exam exam1 : ExamArray)
if(Exam.ExamID==ExamID)
{
myExam.ExamID = exam1.ExamID;
myExam.ExamTitle = exam1.ExamTitle;
myExam.CreditHours = exam1.CreditHours;
myExam.Description = exam1.Description;
myExam.PrerequisiteExam = exam1.PrerequisiteExam;
}
return myExam;
}
我究竟需要改变什么?请帮忙。
好的,我再次更改但同样的错误..它在第 1 行显示错误..
public Exam GetExamByExamID(int ExamID)
{
Exam myExam = new Exam(0,"",0,"","");
for(Exam exam1 : ExamArray)
if(exam1.ExamID==ExamID)
{
myExam.ExamID = exam1.ExamID;
myExam.ExamTitle = exam1.ExamTitle;
myExam.CreditHours = exam1.CreditHours;
myExam.Description = exam1.Description;
myExam.PrerequisiteExam = exam1.PrerequisiteExam;
}
return myExam;
}