Sharon,
You either use reflection or you can use Activator.CreateInstance method
providing the Type object or strings for the type name and declaring
assembly.
With reflection you need to call Type.GetContructor and then call Invoke
method on the returned ConstructorInfo object.
--
HTH
Stoitcho Goutsev (100)
You can either get
"Sharon" <(E-Mail Removed)> wrote in message
news:F751CDB2-76E1-4B72-9433-(E-Mail Removed)...
>I have a list of System.Type and I wish to create an instance for each of
> this types.
>
> string[] types = "System.Boolean", "System.Int32", "System.Single",
> "System.Double", "System.String", "System.DateTime"};
>
> System.Type type;
>
> for( int i=0; i<types .Length; ++i )
> {
> type = System.Type.GetType(rowTypes[i]);
>
> // Missing code in here...
> }
>
>
> Can anybody now how can I do that?
>
>
> ---------
> Thanks
> Sharon
|