Extract class definitions from .NET assembly

The "Extract Class definitions from Assembly" utility is used to convert classes and interfaces in an .NET assembly to Pascal or C# source files. Both .NET framework 1.1 and 2.0 assemblies can be read.

This utility is available in ModelMaker 8.08 up, ModelMaker Code Explorer v3.12 up and ModelMaker Code Explorer for Visual Studio 1.05 up

C# Example

Here's a snippet sample C# code for mscorlib.dll which contains the FCL classes in namespace System etc.

namespace System {
  public class Object {
    protected virtual void Finalize(){}
    public virtual int GetHashCode(){}
    public virtual bool Equals(System.Object obj){}
    public virtual string ToString(){}
    private Type InternalGetType(){}
    private Type FastGetExistingType(){}
    public static bool Equals(System.Object objA, System.Object objB){}
    public static bool ReferenceEquals(System.Object objA, System.Object objB){}
    public Type GetType(){}
    protected System.Object MemberwiseClone(){}
    private void FieldSetter(string typeName, string fieldName, System.Object val){}
    private void FieldGetter(string typeName, string fieldName,
                ref System.Object val){}
    private FieldInfo GetFieldInfo(string typeName, string fieldName){}
    public Object(){}
  }

  public interface ICloneable {
    System.Object Clone();
  }
  // ETC. ETC. ETC.

}

Here's the same snippet from mscorlib.dll extracted as Pascal code

unit mscorlib;

interface

type
  &Object = class(System.Object)
  strict protected
    procedure Finalize(); overload; virtual;
  public
    function GetHashCode(): Integer; overload; virtual;
    function Equals(obj: System.Object): Boolean; overload; virtual;
    function ToString(): string; overload; virtual;
  strict private
    function InternalGetType(): &Type; overload;
    function FastGetExistingType(): &Type; overload;
  public
    class function Equals(objA: System.Object; objB: System.Object): Boolean;
            overload; static;
    class function ReferenceEquals(objA: System.Object;
            objB: System.Object): Boolean; overload; static;
    function GetType(): &Type; overload;
  strict protected
    function MemberwiseClone(): System.Object; overload;
  strict private
    procedure FieldSetter(typeName: string; fieldName: string;
            val: System.Object); overload;
    procedure FieldGetter(typeName: string; fieldName: string;
            var val: System.Object); overload;
    function GetFieldInfo(typeName: string; fieldName: string): FieldInfo; overload;
  public
    constructor Create(); overload;
  end;

  ICloneable = interface
    function Clone(): System.Object; overload;
  end;

  // ETC. ETC. ETC.
implementation
  // entire implementation section removed in this sample
end.

Currently only class, interface and delegate types are imported - records / structs are skipped. Nested types are skipped: you'll get warnings when applicable. .NET Attributes and documentation as stored in the assembly are currently not emitted.