我有一個list
如下給出的硬編碼數據記錄。現在我想在這個清單上執行一些功能,這些功能會返回大多數高年級和初中的學生,以及一種可以返回第一卷的方法。所有學生和最後一種方法,其中FirstName="ali"
返回學生。從c列表中獲取數據#
這是我當前的代碼:
List<StnRecDAL> objlist = new List<StnRecDAL>();
objlist.Add(new StnRecDAL { RollNo = 1, FirsName = "ali", LastName = "helo", ClassName = "a", SessionYear = "2002" });
objlist.Add(new StnRecDAL { RollNo = 2, FirsName = "ali", LastName = "helo", ClassName = "b", SessionYear = "2003" });
objlist.Add(new StnRecDAL { RollNo = 3, FirsName = "ali", LastName = "helo", ClassName = "c", SessionYear = "2004" });
objlist.Add(new StnRecDAL { RollNo = 4, FirsName = "ali", LastName = "helo", ClassName = "d", SessionYear = "2005" });
objlist.Add(new StnRecDAL { RollNo = 5, FirsName = "ali", LastName = "helo", ClassName = "e", SessionYear = "2006" });
objlist.Add(new StnRecDAL { RollNo = 6, FirsName = "ali", LastName = "helo", ClassName = "f", SessionYear = "2007" });
objlist.Add(new StnRecDAL { RollNo = 7, FirsName = "ali", LastName = "helo", ClassName = "g", SessionYear = "2008" });
objlist.Add(new StnRecDAL { RollNo = 8, FirsName = "ali", LastName = "helo", ClassName = "h", SessionYear = "2009" });
objlist.Add(new StnRecDAL { RollNo = 9, FirsName = "ali", LastName = "helo", ClassName = "i", SessionYear = "20010" });
objlist.Add(new StnRecDAL { RollNo = 10,FirsName = "ali", LastName = "helo", ClassName = "j", SessionYear = "20011" });`
建議和指導如何這裏着手讚賞。
列表 objlist =新列表(); –
你能澄清你的問題嗎?它是相當混亂.BTW由「20010」和「20011」你的意思是「2010」和「2011」我猜:) –
嘗試自己製作這些方法,如果遇到問題,那麼你可以嘗試詢問StackOverflow。 – cubrr