using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace P111实验3
{
class Student
{
private string id;
private string name;
private double chinese;
private double math;
private double english;
public Student(string id,string name,double chinese,double math,double english)
{
this.id = id;
this.name = name;
this.chinese = chinese;
this.math = math;
this.english = english;
}
public string Id
{
set { this.id = value; }
get{return this.id ;}
}
public string Name
{
set { this.name = value; }
get { return this.name; }
}
public double Chinese
{
set { this.chinese = value; }
get { return this.chinese; }
}
public double Math
{
set { this.math = value; }
get { return this.math; }
}
public double English
{
set { this.english = value; }
get { return this .english ;}
}
public double Total{
get { return chinese + math + english; }
}
}
}
s.id = textBox1.Text;
s.name = textBox2.Text;
s.chinese = Convert.ToDouble(textBox3.Text);
s.math = Convert.ToDouble(textBox4.Text);
s.english = Convert.ToDouble(textBox5.Text);
n++;
label7.Text = "已成功添加一个学生!此学生信息为:";
lable7.text += "学号:" + this.id + "姓名:" + this.name + "语文成绩:" + this.chinese + "数学成绩:" + this.math + "英语成绩:" + this.english;
}
}
最后这一段代码s.id, s.name, s.chinese, s.math, s.english有错为什么呢?谢谢
错误 1 “System.Array”不包含“id”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“id”(是否缺少 using 指令或程序集引用?)
错误 2 “System.Array”不包含“name”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“name”(是否缺少 using 指令或程序集引用?)
错误 3 “System.Array”不包含“chinese”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“chinese”(是否缺少 using 指令或程序集引用?)
错误 4 “System.Array”不包含“math”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“math”(是否缺少 using 指令或程序集引用?)
错误 5 “System.Array”不包含“english”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“english”(是否缺少 using 指令或程序集引用?)