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:

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,