using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
string dataAssembly = "System.Data,version =4.0.0.0,culture = neutral,PublicKeyToken=b77a5c561934e089";
LoadAssemAndShowPublicTypes(dataAssembly);
Console.Read();
}
private static void LoadAssemAndShowPublicTypes(string dataAssembly)
{
Assembly a = Assembly.Load(dataAssembly);
foreach (Type t in a.ExportedTypes)
{
Console.WriteLine(t.FullName + Environment.NewLine);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Runtime.InteropServices;
namespace ConsoleApp1
{
internal sealed class Dictionary<TKey, TValue>
{
public TKey Key { get; set; }
public TValue Value { get; set; }
public Dictionary(TKey k, TValue v)
{
Key = k;
Value = v;
}
public override string ToString()
{
return $"Key :{Key} Value:{Value}";
}
}
class Program
{
static void Main(string[] args)
{
Type openType = typeof(Dictionary<,>);
Type closedType = openType.MakeGenericType(typeof(String), typeof(Int32));
Object o = Activator.CreateInstance(closedType,"xxxxx",2);
Console.WriteLine(o.ToString());
Console.Read();
}
}
}
