c# - Call `Current` for IEnumerable using Reflection.Emit -
Please advise how I can call property I like something: : {"The archive was modified, calculation work could not be executed."} and when I store the calculator by address (LDLCC -> LDLOCAI) This fails: {"Attempted to read or write secure storage. It is often indicated that other memory is corrupt." } Specifies the array returns anonymator based on not in the list but it is generating the result: If you want to implement your code, then you type and method with Infos Must have work, not typeBuilders and MethodBuilders. Therefore, you need CreateType () and then use that type and its method: moveNext
IEnumerable & lt; Byte & gt; .
target
var bytes name = byteArray.EnumerateArray (); Var controlByte = bytesEnumerator.Current; bytesEnumerator.MoveNext (); Here is the code:
Local Builder lbBytesEnumerator = IL.DeclareLocal (typef (IEnumerator & lt; byte & gt;); Receive an Inamator at // bytes IEL.Emit (OpCodes.Ldarg_0); IL Amitcoll (op.sodes.colle, typef (biotechnopter). Getimpeg ("enumerator"), new [] {typef (byte [])}; IL Amit (opsodes.stok, lbbetnamater); ....... IL Amit (Open Seeds. LDLOCC, LBBET Annamter); IL Emitcoll (op.Seeds.Coll, Typhus (AynmMeter & Lt; Byte & gt;). GetProperty ("Current"). GetGetMethod (), Faucet); Local Builder lbControlByte = IL.DeclareLocal (propertyInfo.PropertyType); IL Amit (op.Seeds.stock, LBCTolbet); // Enumerator Move IEL.Emit (OpCodes.Ldloc_S, lbBytesEnumerator); IL Emitcoll (op.Seeds.Coll, callphrase (list & lt; byte & gt; enumerator) .GetMethod ("move next"), blank); il.Emit (OpCodes.Pop); Failed with
different 2
...... il.Emit (OpCodes. Ldloca_S, lbBytesEnumerator); IL Emitcoll (op.Seeds.Coll, TypeF (AynmMeter & Lt; Byte & gt;) GetProperty ("Current"). GetGetMethod (), Faucet); Local Builder lbControlByte = IL.DeclareLocal (propertyInfo.PropertyType); IL Amit (op.Seeds.stock, LBCTolbet);
update:
< code> (var i = 0; i
var generatedType = typebuilder.CreateType (); Var funcType = typeof (Func & lt ;, & gt;) MakeGenericType (Generated Type, Typef (IEnumerable & lt; string & gt;)); Var D = Generate Type Getmip ("move next"). Make Delegate (Functip);
Comments
Post a Comment