Created
October 23, 2012 17:15
-
-
Save kw0006667/3940157 to your computer and use it in GitHub Desktop.
10個學生的成績
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ListConsoleApp | |
{ | |
public class Student | |
{ | |
public string Name; | |
public int Score; | |
public Student(string name, int score) | |
{ | |
this.Name = name; | |
this.Score = score; | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
List<Student> students = new List<Student>(){ new Student("Student A", 90), | |
new Student("Student B", 75), | |
new Student("Student C", 83), | |
new Student("Student D", 94), | |
new Student("Student E", 60), | |
new Student("Student F", 56), | |
new Student("Student G", 30), | |
new Student("Student I", 73), | |
new Student("Student J", 68), | |
new Student("Student K", 46)}; | |
foreach (var stu in students) | |
Console.WriteLine("Name: {0}, Score: {1} ", stu.Name, stu.Score); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment