void DoDefaultInitialize()
{
const string _defType = "System.Configuration.ConfigurationManager, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
Type configMananger = SimpleTypeFinder.WeakResolver(_defType, false);
// Type op_equality is not portable: use ReferenceEquals.
if (!ReferenceEquals(configMananger, null))
{
Type[] stringParams = new Type[] { typeof(string) };
MethodInfo getAppSettings = configMananger.GetProperty("AppSettings", BindingFlags.Public | BindingFlags.Static).GetGetMethod();
MethodInfo indexer = getAppSettings.ReturnType.GetProperty("Item", typeof(string), stringParams).GetGetMethod();
DynamicMethod getter = new DynamicMethod("CK-ReadConfigurationManagerAppSettings", typeof(string), stringParams, true);
ILGenerator g = getter.GetILGenerator();
g.EmitCall(OpCodes.Call, getAppSettings, null);
g.Emit(OpCodes.Ldarg_0);
g.EmitCall(OpCodes.Call, indexer, null);
g.Emit(OpCodes.Ret);
_initializedGetObject = _getObject = (Func <string, object>)getter.CreateDelegate(typeof(Func <string, object>));
_initialized = true;
}
else
{
throw new CKException(Impl.CoreResources.AppSettingsDefaultInitializationFailed);
}
}