12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace HTEXScan.Models
- {
- /**学生id数据**/
- class SidData
- {
- /**col**/
- public int Col
- {
- get;
- set;
- }
- /**值**/
- public char Text
- {
- get;
- set;
- }
- }
- /**学生id**/
- class Sid
- {
- /**max col**/
- private int maxCol = 0;
- /**学生id缓存数据**/
- private List<SidData> datas = new List<SidData>();
- /**添加**/
- public void Add(int col, char text)
- {
- SidData data = new SidData();
- data.Col = col;
- data.Text = text;
- this.datas.Add(data);
- if (col > maxCol)
- maxCol = col;
- }
- /**获取**/
- public List<string> Get()
- {
- List<string> ids = new List<string>();
- char[] dats = new char[maxCol];
- this.GetData(ids, dats, 1);
- return ids;
- }
- /**获取**/
- private void GetData(List<string> ids, char[] dats, int col)
- {
- if(col > this.maxCol)
- {
- ids.Add(new string(dats));
- }
- else
- {
- for(int i = 0;i < this.datas.Count;i++)
- {
- if (this.datas[i].Col == col)
- {
- dats[col - 1] = this.datas[i].Text;
- this.GetData(ids, dats, col + 1);
- }
- }
- }
- }
- }
- }
|