c# - IL: ldfld vs ldflda -
i'm writing small il-weaving application using mono.cecil, requires me manipulate target assembly on il level.
my question quite simple, still find matter confusing. what practical difference between ldfld , ldflda instructions?
i have consulted msdn, , appears while ldfld fetches value of field, ldflda gets address of field. okay... mean? first thought former used value types (and string), , latter reference types, have compiled c# snippet , checked in reflector, , proved me wrong.
i haven't been able find distinct pattern in when c# compiler emits ldflda instead of ldfld, , searches didn't reveal articles explain this. when use ldflda instead of ldfld?
any appreciated.
i guess used structures:
struct counter { public int i; } struct { public counter c; } s; s.c.i++; i pretty sure c here loaded address otherwise create copy of counter. that's why can't propery.
Comments
Post a Comment