Place an object on top of stack in ILGenerator
- by KiNGPiN
I have to pass a function an instance of an object, so obviously all the information to be taken as argument is to be loaded onto the evaluation stack
Here is the code that i am looking for
someClass SomeObject = new someClass();
il.Emit(OpCodes.LoadObject, SomeObject);
il.Emit(OpCodes.CallVirt, MethodInfo Function);
public void Function(Object obj)
{
Type type = typeof(obj);
//do something w.r.t to the type
}
I dont require any information stored in the class just the type and i cannot use any of the primitive types to take my decision on
Last i read that i can use a pointer to load the type using some opcodes ... but i am completely lost here, any help or pointers to the right direction would be great :)