Skip to content

Working with IMonoClass

RoqueDeicide edited this page Jan 2, 2015 · 1 revision

IMonoClass object provide access to details about a Mono class: members, location in inheritance tree, implemented interfaces.

Methods

In order to get the pointer to IMonoMethod object that represents a method you want you can use a variety of method all of which require the name, and some more information that can specify the overload:

  • If you are going to invoke the method while using IMonoArray of arguments you can use the same array to get the appropriate IMonoMethod wrapper.
  • If your method's overload has a unique number of parameters, you can use that number.
  • You can also use text that describes the types of parameters to get specific overload.

Fields

You can get and set fields of managed objects with Get/SetField methods as long as you provide a reference to that object. You shouldn't try accessing fields of boxed value-type objects with these though.

Properties

Same as with fields, however you can get and set properties of value-type objects, if you provide a pointer to the unboxed instance of such.

Inheritance and Implementations

You can check whether the class inherits another or implements some interface.

Instanciation

You can create an instance of the class with CreateInstance method by providing a Mono array of arguments for constructor.