Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Linq;
  5. namespace ConsoleApp1
  6. {
  7. class Student {
  8. public string name;
  9. public uint score;
  10. }
  11. class ClassRoom {
  12. public List<Student> students = new List<Student>();
  13.  
  14. //定義索引
  15. public List<Student> this[uint score] {
  16. get {
  17. return students.Where(o => o.score == score).ToList();
  18. }
  19.  
  20. }
  21.  
  22.  
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement