c# - Call `Current` for IEnumerable using Reflection.Emit -


Please advise how I can call property and moveNext IEnumerable & lt; Byte & gt; .

target

I like something:

  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   

:

{"The archive was modified, calculation work could not be executed."}

different 2

and when I store the calculator by address (LDLCC -> LDLOCAI)

  ...... 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);   

This fails:

{"Attempted to read or write secure storage. It is often indicated that other memory is corrupt." }

update:

Specifies the array returns anonymator based on not in the list but it is generating the result:

 < code> (var i = 0; i  

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:

  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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -