Sky said:
FYI: What I just wrote to list the classes within a namespace, and it
works
(bare typos...),
is listed below...I just havn't figured out a way to pass a Namespace as
an
argument...
(BTW: What is a namespace -- is there a System.Type for it? Couldn't see
one)...
A namespace is really a very vauge concept. As far as the typing system
goes, namespaces are just a part of the name(although they are stored
seperatly physically). There is no Type for a namespace, nor is a namespace
restricted to a single assembly. The best you can do is enumerate all types
in a given assembly and match hte namespace to the namespace in the type,
much as you do below. You'll have to pass the namespace as a string.
Any and all help appreciated!
public string[] EnumerateClassesInNameSpace(System.Type
qAClassWithinNamespace){
System.Collections.ArrayList tResult = new System.Collections.ArrayList();
System.Type tTypeIN = qClassWithinNamespace;
System.Type tType;
string tNS = tTypeIN.Namespace;
System.Type[] tTypes = tTypeIN.Assembly.GetTypes();
for (int i=0;i<tTypes.Length;i++){
tType = tTypes;
if ( (tType.MemberType == System.Reflection.MemberTypes.TypeInfo) &&
(tType.Namespace == tNS) ){
tResult.Add(tType);
}
}
return (System.String)tResult.ToArray(typeof(System.String));
}