Business and Technology Consulting Organization in Mumbai

Electronic Transformation Globally Technology Solution IT Consultancy Service Provider

Generic in Asp.net 2.0, Asp.net Developer in India

Masterpage in Asp.Net 2.0Asp.Net 2.0Session in Asp.Net 2.0
Generic in .Net 2.0Caching in .Net 2.0Async Mailing
Ado.net 2.0Asp.net data controlsAsp.net 3.5 new features
We have expert Asp.net developers in Mumbai India, Please contact us to know more about our service.
This is how we can convert IList to a generic List<> collection
Convert IList to Generic
/// <summary>
1: /// Convert IList to Generic List<> Example: BasicFunctions.ConvertToListOf<MyObject>(IListObject)
2: /// </summary>
3: /// <typeparam name="T"></typeparam>
4: /// <param name="iList"></param>
5: /// <returns></returns>
6: public static List<T> ConvertToListOf<T>(System.Collections.IList iList)
7: {
8: List<T> result = new List<T>();
9:
10: foreach (T value in iList)
11: result.Add(value);
12:
13: return result;
14: }
15:


Find and FindAll matching object in any generic List<> collection
Find FindAll in generic List object
using System;
1:using System.Collections.Generic;
2:
3:namespace Arindam
4:{
5: public class FindFindAll
6: {
7: // List<>.Find implementation
8: List<MyCustomObject> MyCustomObjectList = new List<MyCustomObject>();
9: MyCustomObject _obj = MyCustomObjectList.Find((delegate(MyCustomObject _a) { bool b = (_a.ParentId == _row.ChildId) ? true : false; return b; }));
10:
11:
12: // List<>.FindAll implementation
13: List<MyCustomObject> _objCustomObjectList = MyCustomObjectList.FindAll((delegate(MyCustomObject _a) { bool b = (_a.Id == 1 || _a.Id== 2) ? true : false; return b; }));
14: }
15:}
16:


Example of generic parameter
Find FindAll in generic List object
Specified file can't be found
Leave your comment.

Reduce your Dialy IT Cost, Consult with us
Stay healthy in recession

Advertisement
Sponsored by

HR Recruitment & Process Management System
Jewellery production process management software
Share
©2009 ETG Consultancy, All Rights Reserved Privacy Policy | Terms & Conditions
Asp.net, Ado.net, .Net Remoting, .Net Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML