Nicholas
Thanks for the response. however, I'm not able to follow. Since List<T>
cannot accept List<typeof(myClassName)it must be requiring something other
than a Type object. I( have written a method that uses reflection to turn
the string "myClassName" into a Type much like like
Type.GetType("myClassName).
However the generic List<Twill not accept a method call or variable as the
argument for T.
The challenge here is that I am getting my class names through XML and must
now instatiate a series of Generics like List<Tto use against my
framework's method signatures.
Could you restate your last reply in code? I think it would help me
understand your your perspective.
Thanks
"Nicholas Paldino [.NET/C# MVP]" wrote:
HaySeed,
No, there isn't. You will have to use reflection to create the generic
type (from the generic Type, and the Type you want to use as a type
parameter). You would also have to use relfection to access the members,
since you can not place an interface on List<T(unless you derive from
List<Tand then implement an interface which you can use to abstract access
to it).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"HaySeed" <Ha*****@discussions.microsoft.comwrote in message
news:CE**********************************@microsof t.com...
Is there some way to use Generics in dynamic code using the
Type.GetType("MyClassName")
as an argument?
List<Type.GetType("MyClassName") oList = new
List<Type.GetType("MyClassName") >
... or is there a way to declare a generic using strings that hold class
names that have been pulled from XML at run time.