本文整理汇总了C#中System.Reflection.Binder.ConvertArgs方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.ConvertArgs方法的具体用法?C# Binder.ConvertArgs怎么用?C# Binder.ConvertArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Binder
的用法示例。
在下文中一共展示了Binder.ConvertArgs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invoke
public override Object Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
if (binder == null)
binder = Binder.DefaultBinder;
ParameterInfo[] pinfo = MonoMethodInfo.GetParametersInfo (mhandle, this);
if (!binder.ConvertArgs (parameters, pinfo, culture, (invokeAttr & BindingFlags.ExactBinding) != 0))
throw new ArgumentException ("failed to convert parameters");
#if !NET_2_1
if (SecurityManager.SecurityEnabled) {
// sadly Attributes doesn't tell us which kind of security action this is so
// we must do it the hard way - and it also means that we can skip calling
// Attribute (which is another an icall)
SecurityManager.ReflectedLinkDemandInvoke (this);
}
#endif
if (obj == null && DeclaringType.ContainsGenericParameters)
throw new MemberAccessException ("Cannot create an instance of " + DeclaringType + " because Type.ContainsGenericParameters is true.");
if ((invokeAttr & BindingFlags.CreateInstance) != 0 && DeclaringType.IsAbstract) {
throw new MemberAccessException (String.Format ("Cannot create an instance of {0} because it is an abstract class", DeclaringType));
}
Exception exc = null;
object o = null;
try {
o = InternalInvoke (obj, parameters, out exc);
#if NET_2_1
} catch (MethodAccessException) {
throw;
#endif
} catch (Exception e) {
throw new TargetInvocationException (e);
}
if (exc != null)
throw exc;
return (obj == null) ? o : null;
}