导航

2013年3月13日

摘要: 定义一个简单的类型:Student,Id属性是成员的键。classStudent {publicintId {get;set; }publicstringName {get;set; } }KeyedCollection这样定义://+ using System.Collections.ObjectModel;classMyKeyedCollection:KeyedCollection<int,Student> {//辅助添加方法publicvoidAdd(intid,stringname) { Add(newStudent() { Id=id, Name=name }); }// 阅读全文

posted @ 2013-03-13 14:00 wangmcu 阅读(493) 评论(0) 推荐(0)