Beispiel #1
0
 /// <summary>
 /// WARNING: Pubternal API (internal). Do not use. May change during any update.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="F"></typeparam>
 /// <param name="fieldInfo"></param>
 /// <returns></returns>
 public static Func <T, F> CreateFastFieldGetter <T, F>(FieldInfo fieldInfo)
 {
     if (ClrTypes.DynamicMethodDefinition != null)
     {
         return(CreateFastFieldGetterForCecil <T, F>(fieldInfo));
     }
     else
     {
         return(ReflectionEmitFastReflectionHelper.CreateFastFieldGetter <T, F>(fieldInfo));
     }
 }
Beispiel #2
0
        private static Func <T, F> CreateFastFieldGetterForSRE <T, F>(FieldInfo fieldInfo)
        {
            try
            {
                return(ReflectionEmitFastReflectionHelper.CreateFastFieldGetter <T, F>(fieldInfo));
            }
            catch (Exception e2)
            {
                XuaLogger.Common.Warn(e2, "Failed creating fast reflection delegate through with reflection emit. Falling back to standard reflection...");

                return((target) => (F)fieldInfo.GetValue(target));
            }
        }