using System;
using System.Collections;
using System.Reflection;
public class MainClass{
public static void Main() {
Assembly LoadedAsm = Assembly.LoadFrom("yourName");
Console.WriteLine(LoadedAsm.FullName);
Type[] LoadedTypes = LoadedAsm.GetTypes();
if (LoadedTypes.Length == 0) {
Console.WriteLine("\tNo Types!");
} else {
foreach (Type t in LoadedTypes) {
if (t.IsPublic && !t.IsEnum && !t.IsValueType) {
Console.WriteLine("Type: {0}", t.FullName);
PrintPropertyInfo(t);
}
}
}
}
private static void PrintPropertyInfo(Type t) {
PropertyInfo[] props = t.GetProperties
(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
foreach (PropertyInfo p in props) {
Console.WriteLine("Property: {0}", p.Name);
Console.WriteLine("\tType {0}", p.PropertyType.FullName);
if (p.CanRead)
Console.WriteLine("Readable property.");
if (p.CanWrite)
Console.WriteLine("Writable property.");
ParameterInfo[] pList = p.GetIndexParameters();
if (pList.Length == 0) {
Console.WriteLine("\tNo Parameters");
} else {
Console.WriteLine("\tParameter List:");
foreach (ParameterInfo parm in pList) {
Console.WriteLine("\t\t{0} {1}", parm.ParameterType.FullName,parm.Name);
}
}
}
}
}
|