This project is read-only.

Duck Type ?

Jul 9, 2010 at 5: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 9: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 11:13 PM
Edited Jul 18, 2010 at 1:37 PM

code removed

Jul 12, 2010 at 9: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 ?