SHARE
TWEET

Untitled

a guest Sep 15th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top