sharing about .NET and technology RSS 2.0
 Sunday, October 14, 2007

On my current project I had the need to iterate through the properties of an object with reflection and to check if one of the properties is a generic List type, e.g. IList<int>, IList<Customer>, etc. To check through reflection on a generic type, you need to use the GetGenericTypeDefinition method.

Copy Code
foreach (PropertyInfo propertyInfo in entity.GetType().GetProperties()) { if (propertyInfo.PropertyType.IsGenericType && typeof(List<>).IsAssignableFrom(propertyInfo.PropertyType.GetGenericTypeDefinition())) { IEnumerable enumerable = propertyInfo.GetValue(entity, null) as IEnumerable; IEnumerator enumerator = enumerable.GetEnumerator(); while (enumerator.MoveNext()) { // do something } } }
Sunday, October 14, 2007 10:49:11 PM (Romance Standard Time, UTC+01:00)  #    Comments [1] -

Wednesday, October 17, 2007 7:24:19 PM (Romance Standard Time, UTC+01:00)
Hi Delarou,

SuperFandango is a .NET(mainly) and database driven applications specialist company based in Bruxelles.

At the moment, we have a need for extra .net/sql server/ classic asp + vb6 skills.

We came across you via some user group listing.

We would like to get a copy of your CV along with your contact details (email and phone). So thanks to email them to michael.finlan@superfandango.com .


If you know any people with Microsoft Technology skills that are looking for a contract or an employee position, could you be so kind as to forward them our contact details.

Thanks and best regards,


Michael FINLAN
8 Av. du GEAI
1170 Watermael-Boitsfort
Belgium

Tel/Fax: +32 2 742 0587
GSM: +32 486 423 697
http://www.superfandango.com
michael.finlan@superfandango.com
Michael Finlan
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Navigation
Archive
<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Christoph De Baene
Sign In
Statistics
Total Posts: 151
This Year: 22
This Month: 1
This Week: 0
Comments: 147
All Content © 2008, Christoph De Baene
DasBlog theme 'Business' created by Christoph De Baene (delarou)