Posted on: 6/10/2011 3:44:12 AM | Views : 362

Hi there guys
I'm using the following code to build a dynamic class with one method that must take to int inputs and return an int. My compiler does not give any errors and the dll gets created, but if I try to look at my class using Reflector, it gives an error 'index was outside the bounds of an array" and I have no clue what this refers to??? Here is the c# code that creates the class:
AssemblyName myAssemblyName = new AssemblyName(); myAssemblyName.Name = "Calculator"; AssemblyBuilder myAssembly = Thread.GetDomain().DefineDynamicAssembly(myAssemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder myModule = myAssembly.DefineDynamicModule(myAssemblyName.Name, myAssemblyName.Name + ".dll", true); TypeBuilder myTypeBuilder = myModule.DefineType("Calculator.Calculate", TypeAttributes.Class | TypeAttributes.Public); MethodBuilder myMethod = myTypeBuilder.DefineMethod("Addit ...

Go to the complete details ...