-
November 26th, 2009, 05:29 AM
#1
reference to classes in another namespace
Hi,
I am new to c# so far so good. But I got stuck. I am creating a class library. Some of the methods in a class need a reference to an instance of a class in another namespace. I cannot simply add a reference to this namespace in the project because at runtime this namespace will be dynamically created. I do, however, know what the classes in this namespace look like.
I tried something like this:
[code]
Code:
public Type uClass;
...
Assembly *** = Assembly.GetExecutingAssembly();
foreach (Type type in ***.GetTypes())
{
if (type1.IsClass){
if (type1.Name == "myclass"){
uClass = type1;
}
}
}
But then, when I use uClass I get the error message:
" uClass is a 'field' but is used like a 'type' "
What goes wrong here? Or is there a much better way to do what I am trying to do? I mean, the next step is getting access to all the properties in this class. How would I do that?
Hope someone can get me back on track,
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|