Changeset 3606
- Timestamp:
- 05/04/10 15:11:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs
r3579 r3606 62 62 MethodInfo methodInfo = memberInfo as MethodInfo; 63 63 if (memberInfo.MemberType != MemberTypes.Method || memberInfo == null) 64 throw new ArgumentException("Storable hooks must be methods"); 65 if (System.IntPtr.Size == 4) { 66 DynamicMethod dm = new DynamicMethod("", null, new[] { typeof(object) }, type); 67 ILGenerator ilgen = dm.GetILGenerator(); 68 ilgen.Emit(OpCodes.Ldarg_0); 69 ilgen.Emit(OpCodes.Callvirt, methodInfo); 70 ilgen.Emit(OpCodes.Ret); 71 yield return (Hook)dm.CreateDelegate(typeof(Hook)); 72 } else { 73 yield return new Hook(o => methodInfo.Invoke(o, emptyArgs)); 74 } 64 throw new ArgumentException("Storable hooks must be methods"); 65 DynamicMethod dm = new DynamicMethod("", null, new[] { typeof(object) }, type); 66 ILGenerator ilgen = dm.GetILGenerator(); 67 ilgen.Emit(OpCodes.Ldarg_0); 68 ilgen.Emit(OpCodes.Callvirt, methodInfo); 69 ilgen.Emit(OpCodes.Ret); 70 yield return (Hook)dm.CreateDelegate(typeof(Hook)); 75 71 } 76 72 }
Note: See TracChangeset
for help on using the changeset viewer.