Quick access. Search related threads. Remove From My Forums. Answered by:. Archived Forums. Visual C. Sign in to vote. GetType "NameSpace. Is it a bug in C or am I missing something. Thanks Suresh. Follow Post Reply. The problem is that Type. GetType, when just given a class name and not the assembly information, only looks in the current assembly and mscorlib. You could either fully specify the name including the assembly name, version etc or you could use Assembly.
GetType, having loaded the assembly. This discussion thread is closed Start new discussion. Similar topics. NET Framework. Can you give some sample data? Might be helpful. I'm pretty sure it's the namespace issue below, but want to make sure. Maybe we should also ask, what is the problem this is trying to solve, we may know an easier solution as well I'm curious why take the Type to XmlSerializableType and back?
Why is this being done? If we know why, perhaps we could suggest an easier way to perform the same task? Or at least know more about why it can't find the class. From Ui of our application we set one value, after saving that if we load the application again its returnig null setting in to a default value that was the root cause.
While loading our application there are lot of process going on between server part and client part after completing certain event only we should pass request, but we are passing request early thats the reason — rickymartin. Does the assembly with the type have an auto-incrementing version property? Show 15 more comments. Active Oldest Votes. GetType string name , it returns: An object that represents the specified class, or Nothing if the class is not found.
GetType Method String It's evident the assembly exists or it would return null and you'd get a NullReferenceException , so another possibility is you don't have the same version of the assembly you are expecting i. Improve this answer. Are these types returned across the wire through a service to a different machine? Are you sending these serializable classes over a web service and another program on another machine is attempting to re-create them? Or is this all in the same program?
Show 1 more comment. Akash Kava Akash Kava GetType can return non-public types from assemblies, you only run into potential issues if you attempt to use them. Connect and share knowledge within a single location that is structured and easy to search. The problem I am having is that Type. GetType typeName is returning null. What am I missing here? GetType string only looks in the currently executing assembly and mscorlib when you don't specify the assembly name within the string.
If you have an easy way of getting hold of the relevant assembly e. Assembly then the second option is probably simpler. GetType looks as the calling assembly, and a few system assemblies. For anything else, you must either use assemblyInstance. GetType typeName , or you must use the "assembly qualified name" of the type, which includes the assembly details in which the type can be found.
Otherwise, it wont be found, and will return null. You can get that from:. I had a very similar problem to the original poster, except that I needed to instantiate the code-behind class of my custom user-control in a static utility class rather than an ASPX page, so LoadControl wasn't available to me.
Here's what I ended up doing:.
0コメント