This is my first coding blog for IronPython in which I convert my old blog List of all Form from an Assembly in IronPython code. I use Visual Studio 2005 IronPython Console template so you need to add the following lines of code explicitly when use are writing code on command prompt to add reference of System.dll
|
import clr
clr.AddReference("System")
|
Here are the few bytes that IronPython developers use when they want to get a list of types from particular assembly.
|
from System import *
from System.Reflection import *
def GetTypeList(assemblyName, assemblyVersion):
_assemblyname = AssemblyName()
_assemblyname.Name = assemblyName
v = Version(assemblyVersion)
_assemblyname.Version = v;
assembly = Assembly.Load(_assemblyname)
Console.WriteLine("Listing all types in {0}", assembly.FullName)
Console.WriteLine()
types = assembly.GetTypes()
for type in types:
Console.WriteLine(type)
GetTypeList('IronMath.dll','1.1.0.0')
Console.ReadLine();
|
In the preceding codes I test the IronMath.dll itself with it version ‘1.1.0.0’. For C# version of this code read this blog.