コード例 #1
0
        private static Func <T, F> CreateFastFieldGetterForCecil <T, F>(FieldInfo fieldInfo)
        {
            try
            {
                return(CecilFastReflectionHelper.CreateFastFieldGetter <T, F>(fieldInfo));
            }
            catch (Exception e1)
            {
                try
                {
                    XuaLogger.Common.Warn(e1, "Failed creating fast reflection delegate through with cecil. Retrying with reflection emit...");

                    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));
                }
            }
        }
コード例 #2
0
 private static Func <T, F> CreateFastFieldGetterForCecil <T, F>(FieldInfo fieldInfo)
 {
     return(CecilFastReflectionHelper.CreateFastFieldGetter <T, F>(fieldInfo));
 }