static ReflectionDelegates() { var type = typeof(Type); GetProperties = (GetTypeProperties)Delegate.CreateDelegate(typeof(GetTypeProperties), type.GetMethod("GetProperties")); GetCustomAttributes = (GetTypeCustomAttributes)Delegate.CreateDelegate(typeof(GetTypeCustomAttributes), type.GetMethod("GetCustomAttributes")); GetCustomAttribute = (GetTypeAttribute)Delegate.CreateDelegate(typeof(GetTypeAttribute), type.GetMethod("GetCustomAttribute")); GetMethod = (GetTypeMethod)Delegate.CreateDelegate(typeof(GetTypeMethod), type.GetMethod("GetMethod")); GetConstructors = (GetTypeConstructors)Delegate.CreateDelegate(typeof(GetTypeConstructors), type.GetMethod("GetConstructors")); }
/// <summary> /// Extensions to the <see cref="IServiceProvider"/> interface /// </summary> static ServiceProviderExtensions() { GetProperties = (GetTypeProperties)Delegate.CreateDelegate(typeof(GetTypeProperties), typeof(Type).GetMethod("GetProperties", new Type[] { })); }