Duck Type ?

Jul 9, 2010 at 4:00 PM

This question is more c# than nHydrate but I can't get my head around and it's been on my mind for months.

Consider the following :

foreach (Categories.FieldNameConstants field in Enum.GetValues(typeof(Categories.FieldNameConstants))) .......

1.  Is there a way, using interfaces, generics or otherwise, so that I can dynamically change Categories ?

I am finding that I am repeating code all over the place, i.e. if I have 50 tables I am having to make 50 foreach statements.

Anyones help on this c# matter would very much be appreciated.



Jul 9, 2010 at 8:25 PM

Would you please post some code so I can see what you are doing? Or if you want to keep it private, please email I would like to see what you are trying to do exactly.

Jul 9, 2010 at 10:13 PM
Edited Jul 18, 2010 at 12:37 PM

code removed

Jul 12, 2010 at 8:21 PM

I guess it is not possible .... this is a limitation of c# and repetative is a reality within the language.  Hence code generators .... sad but true or am I mistaken ?