English 中文(简体)
MSIL Property Setter - Access to the value field
原标题:
  • 时间:2009-11-28 16:59:42
  •  标签:
  • cil

I have the following setter-method, but the object I put in value isn t put through to the called method:

.method public hidebysig specialname instance void set_SeatingCapacity(int32  value ) cil managed
{
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()
    .maxstack 3
    L_0000: ldc.i4 0x6c
    L_0005: ldarg.0 
    L_0006: ldfld int32 Young3.FMSearch.Core.Entities.InGame.BaseObject::MemoryAddress
    L_000b: ldarg.1 
    L_000c: call void Young3.FMSearch.Core.Managers.PropertyInvoker::Set(int32, int32, object)
    L_0011: ret 
}

I want to call the function in L_000c like Set(0x6c, ldfld MemoryAddress, value). The first two fields are correctly posted to the function. Any clue? It looks quite well when doing something similar and looking at the definition in Reflector.

最佳回答

I had to do a box int32, or by making Set into Set<T>.

问题回答

暂无回答




相关问题
CIL, CLS, and CTS in .NET

What is the CIL, CTS, and CLS in .NET and what is the difference between them?

What would you use to build a new compiler for .NET?

I m working on a new toy language that will be statically compiled to .NET s IL code. Off hand I can think of the following to actually generate the IL, but I m open to alternatives: Cecil ILASM

Why .NET code compiles to MSIL?

First .NET code compiles to MSIL and then JIT convert it to machine dependent code. Can any one tell me what all benifits get because of the 2 step compilation.Thanks

MSIL Property Setter - Access to the value field

I have the following setter-method, but the object I put in value isn t put through to the called method: .method public hidebysig specialname instance void set_SeatingCapacity(int32 value ) cil ...

Why do I have to do ldarg.0 before calling a field in MSIL?

I want to call a function, with as parameters a string and an Int32. The string is just a literal, the Int32 should be a field. So I thought it should be something like: .method public hidebysig ...

热门标签