Hi!
I am looking for an easy way to get a Type from a arbitrary string.
What I found looks like:
----
string TypeString = "System.String" ; // only as example...
Type TypeIAmLookingF or = null;
Assembly[] appAssemblies =
System.AppDomai n.CurrentDomain .GetAssemblies( );
foreach (Assembly assembly in appAssemblies)
{
foreach (Type type in assembly.GetTyp es())
{
if (t.ToString().E quals(TypeStrin g))
TypeIAmLookingF or = type;
}
}
---
This is kind of overloaded; is there are more easy way to do this?
Thank you!
Ruben
I am looking for an easy way to get a Type from a arbitrary string.
What I found looks like:
----
string TypeString = "System.String" ; // only as example...
Type TypeIAmLookingF or = null;
Assembly[] appAssemblies =
System.AppDomai n.CurrentDomain .GetAssemblies( );
foreach (Assembly assembly in appAssemblies)
{
foreach (Type type in assembly.GetTyp es())
{
if (t.ToString().E quals(TypeStrin g))
TypeIAmLookingF or = type;
}
}
---
This is kind of overloaded; is there are more easy way to do this?
Thank you!
Ruben
Comment