update MEF to preview 9
[mcs.git] / class / System.ComponentModel.Composition / src / ComponentModel / Microsoft / Internal / SilverlightReflectionInvoke.cs
blob0e2e3f63f1ea7ab5d3e5a024ebad1bf9be591d52
1 #if SILVERLIGHT || !CLR40
3 using System;
4 using System.Reflection;
5 using System.Security;
6 using System.Security.Permissions;
8 namespace Microsoft.Internal
10 internal static class ReflectionInvoke
12 public static object SafeCreateInstance(this Type type, params object[] arguments)
14 return Activator.CreateInstance(type, arguments);
17 public static object SafeInvoke(this ConstructorInfo constructor, params object[] arguments)
19 return constructor.Invoke(arguments);
22 public static object SafeInvoke(this MethodInfo method, object instance, params object[] arguments)
24 return method.Invoke(instance, arguments);
27 public static object SafeGetValue(this FieldInfo field, object instance)
29 return field.GetValue(instance);
32 public static void SafeSetValue(this FieldInfo field, object instance, object value)
34 field.SetValue(instance, value);
37 public static void DemandMemberAccessIfNeeded(MethodInfo method)
43 #endif