S
Sky
Hello:
for the last month, I've been blindly using syntax like:
System.Type tType = System.Type.GetType("MyNS.MyClass");
To get the type from a class def, when I don't have an instantiated object
to work with:
tType = o.GetType();
But this going through a string to get to the class def is really verbose...
And, I've noticed that you can get into a lot of trouble when working with
several assemblies (the IDE can always find the class def, but at run-time,
but at runtime if the classdef is in another assembly it will return
NULL...you have to itterate through all the assemblies to find the def...).
Therefore, my question: Is there any another syntax, that looks closer to
the following, so that I know that the compiler will find it for sure
(rather than having to go through the String method?)
MyNameSpace.MyClass.GetType();
Thanks in advance!
for the last month, I've been blindly using syntax like:
System.Type tType = System.Type.GetType("MyNS.MyClass");
To get the type from a class def, when I don't have an instantiated object
to work with:
tType = o.GetType();
But this going through a string to get to the class def is really verbose...
And, I've noticed that you can get into a lot of trouble when working with
several assemblies (the IDE can always find the class def, but at run-time,
but at runtime if the classdef is in another assembly it will return
NULL...you have to itterate through all the assemblies to find the def...).
Therefore, my question: Is there any another syntax, that looks closer to
the following, so that I know that the compiler will find it for sure
(rather than having to go through the String method?)
MyNameSpace.MyClass.GetType();
Thanks in advance!