Hello, I'm having an issue with a windows forms application assignment, it's supposed to take a list of variables entered in the score and compute the average/variance of those scores when the buttons are pressed, I wasn't sure how to do the variance (button 4) but my Average function on button 3 is having an error that says "does not have a definition for Average" I'm not sure what I'm doing wrong, any help would be greatly appreciated.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Assignment_4_Forms_App
{
public partial class Form1 : Form
{
struct Student
{
public string name;
public List<double> scores;
public Student(string name, List<double> scores)
{
this.name = name;
this.scores = scores;
}
}
Student MyStudent = new Student(" ", new List<double>());
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
TextBoxName.Clear();
TextBoxName.ReadOnly = true;
ButtonEnterName.Visible = !ButtonEnterName.Visible;
}
private void button1_VisibleChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
MyStudent.scores = new List<double>();
MyStudent.scores.Add(int.Parse(TextBoxScore.Text));
}
private void button3_Click(object sender, EventArgs e)
{
LabelAverage.Text = Convert.ToString(MyStudent.Average(MyStudent.scores));
}
private void button4_Click(object sender, EventArgs e)
{
}
}
}