Hi guys,
Ran myself into a brick wall trying to accomplish, what is quite easily possible without generics.
Review the following code:
01. public abstract class Sniffer<T>
02. {
03. public List<T> Sniff(string query)
04. {
05. Type type = typeof(T);
06.
07. foreach (PropertyInfo info in type.GetProperties())
08. {
09. info.SetValue(type, "value_to_set", null);
10. }
11. }
12. }
Line #09 throws and exception on the invocation on the target type, which it cannot determine from 'type'. I tried to get the type back from type, but that only brings back the underlying runtime type, which is also not valid.
Does any one have an idea on how I can get this model to work, I'm sure that this is possible?
Thanks,
Eric
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).