using system;
using system.collections.generic;
using system.linq;
public sc scs
public course courses
public program()
,new student ,
new student ,
new student
};scs = new sc
,new sc ,
new sc ,
new sc ,
new sc ,
new sc ,
new sc ,
new sc ,
new sc
};courses = new course
,new course };}
static void main(string args)
age: ***: birth:",s.sid,s.age,s.***,s.birth);
}console.writeline("********************==我是華麗分割線********************==");
var result1 = p.scs.count();
console.writeline(result1);
console.writeline("********************==我是華麗分割線********************==");
var result2 = p.scs.distinct(new sccompare());//distinct的使用
foreach(var s in result2)
cid: score:", s.sid, s.cid, s.score);
}console.writeline("********************==我是華麗分割線********************==");
var result3 = p.scs.max(s => s.score);//94
console.writeline(result3);
console.writeline("********************==我是華麗分割線********************==");
var result4 = p.scs.groupby(s => s.sid).select(g=>(new ));
foreach (var s in result4)
console.writeline("********************==我是華麗分割線********************==");
var result5 = from s in p.students
join ss in p.scs
on s.sid equals ss.sid
select new ;
foreach (var s in result5)
console.writeline("********************==我是華麗分割線********************==");
var result6 = from rr in (from r in result5
group r by r.sid into g //注意這個 into ,在查詢的過程中劃分出新結果
select new )
where rr.score>170
select rr;
foreach (var s in result6)
console.writeline("********************==我是華麗分割線********************==");
listtt1 = new list,
new t1 ,
new t1 ,
};listtt2 = new list,
new t2 ,
new t2 ,
new t2 ,
new t2 ,
new t2
};var result7 = from t1 in tt1
join t2 in tt2
on t1.id equals t2.id
select new ;
result7 = from t in result7
group t by new into tt
select new ;
console.writeline("id:mac:pv:uv");
foreach (var s in result7)
console.writeline("********************==我是華麗分割線********************==");
var result8 = from s in p.scs
join c in p.courses
on s.cid equals c.cid into left
from l in left.defaultifempty()
select new ;
foreach (var s in result8)
console.writeline("********************==我是華麗分割線********************==");
var result9 = (from t in tt1
where !(from t1 in tt1
select t1.id).take(2).contains(t.id)
select t).take(1);
foreach (var s in result9) //查詢第3條
console.writeline("********************==我是華麗分割線********************==");}}
class student
public int age
public bool ***
public datetime birth
public virtual icollectionscs
}class sc
public string cid
public int score
public virtual icollectionstudents
public virtual icollectioncourses
}class course
public string description
public virtual icollectionscs
}class sccompare:iequalitycomparer
public int gethashcode(sc s)
}class t1
public string mac
}class t2
public int pv
public int uv
}}
複雜一點的add timer
總的來說,timer的用法還是很簡單的。主要需要定義乙個timer list變數timer 先初始化timer init timer timer then 對timer的相關引數賦值 timer.function fun timer.expires jiffies timer delay add t...
一點一點進步
requestparam,是獲取前端傳遞給後端的引數,可以使get方式,也可以是post方式。若前端傳遞的引數和後端接收的引數名稱不一致,則必須要標註。pathvariable,是獲取get方式,url後面引數,進行引數繫結。1.裝箱就是講基本資料型別轉換為包裝類,拆箱就是自動將包裝類轉換為基本資料...
演算法 複雜了一點點的數字回文
題目描述 藍橋杯 歷屆試題 回文數字 時間限制 1sec 記憶體限制 128mb 提交 6668 解決 2736 題目描述 觀察數字 12321,123321 都有乙個共同的特徵,無論從左到右讀還是從右向左讀,都是相同的。這樣的數字叫做 回文數字。本題要求你找到一些5位或6位的十進位制數字。滿足如下...