Ejemplo n.º 1
0
 public static FastInvokeActionCast <T> MakeSetter(FieldInfo field)
 {
     if (field.FieldType.IsInterfaceEx() == true && field.FieldType.IsValueTypeEx() == false)
     {
         int offset = MemoryUtilities.GetFieldOffset(field);
         return((ref T target, object o) =>
         {
             ref T pointer = ref Unsafe.AddByteOffset(ref target, (IntPtr)offset);
             Unsafe.WriteUnaligned(ref Unsafe.As <T, byte>(ref pointer), o);
         });