本文整理汇总了C#中System.Reflection.ParameterModifier类的典型用法代码示例。如果您正苦于以下问题:C# ParameterModifier类的具体用法?C# ParameterModifier怎么用?C# ParameterModifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterModifier类属于System.Reflection命名空间,在下文中一共展示了ParameterModifier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SelectMethod
/// <summary>
/// The only method we implement. Our goal here is to find a method that best matches the arguments passed.
/// We are doing this only with the intent of pulling attached property metadata off of the method.
/// If there are ambiguous methods, we simply take the first one as all "Get" methods for an attached
/// property should have identical metadata.
/// </summary>
public override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
{
// Short circuit for cases where someone didn't pass in a types array.
if (types == null)
{
if (match.Length > 1)
{
throw new AmbiguousMatchException();
}
else
{
return match[0];
}
}
for(int idx = 0; idx < match.Length; idx++)
{
MethodBase candidate = match[idx];
ParameterInfo[] parameters = candidate.GetParameters();
if (ParametersMatch(parameters, types))
{
return candidate;
}
}
return null;
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:33,代码来源:AttachedPropertyMethodSelector.cs
示例2: BindToMethod
public override MethodBase BindToMethod(
BindingFlags bindingAttr,
MethodBase[] match,
ref object[] args,
ParameterModifier[] modifiers,
CultureInfo culture,
string[] names,
out object state
)
{
for (int i = 0; i < args.Length; i++)
{
if (args[i] is string)
{
args[i] = ChangeType(args[i], typeof(string), culture);
}
if (args[i] is int)
{
args[i] = ChangeType(args[i], typeof(int), culture);
}
if (args[i] is bool)
{
args[i] = ChangeType(args[i], typeof(bool), culture);
}
}
return Type.DefaultBinder.BindToMethod(
bindingAttr,
match,
ref args,
modifiers,
culture,
names,
out state
);
}
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:35,代码来源:DomainBinder.cs
示例3: SelectMethod
public override MethodBase SelectMethod(
BindingFlags bindingAttr,
MethodBase[] matchMethods,
Type[] parameterTypes,
ParameterModifier[] modifiers)
{
for (int i = 0; i < matchMethods.Length; ++i)
{
if (matchMethods[i].IsGenericMethodDefinition != _genericMethodDefinition)
continue;
ParameterInfo[] pis = matchMethods[i].GetParameters();
bool match = (pis.Length == parameterTypes.Length);
for (int j = 0; match && j < pis.Length; ++j)
{
match = TypeHelper.CompareParameterTypes(pis[j].ParameterType, parameterTypes[j]);
}
if (match)
return matchMethods[i];
}
return null;
}
开发者ID:x64,项目名称:bltoolkit,代码行数:25,代码来源:GenericBinder.cs
示例4: SelectMethod
public override MethodBase SelectMethod(
BindingFlags bindingAttr,
MethodBase[] matchMethods,
Type[] parameterTypes,
ParameterModifier[] modifiers) {
for (int i = 0; i < matchMethods.Length; ++i) {
if (matchMethods[i].IsGenericMethodDefinition == _genericMethodDefinition) {
ParameterInfo[] pis = matchMethods[i].GetParameters();
bool match = (pis.Length == parameterTypes.Length);
for (int j = 0; match && j < pis.Length; ++j) {
if (pis[j].ParameterType == parameterTypes[j])
continue;
if (pis[j].ParameterType.IsGenericParameter)
match = CheckGenericTypeConstraints(pis[j].ParameterType, parameterTypes[j]);
else if (pis[j].ParameterType.IsGenericType && parameterTypes[j].IsGenericType)
match = CompareGenericTypesRecursive(pis[j].ParameterType, parameterTypes[j]);
else
match = false;
}
if (match)
return matchMethods[i];
}
}
return null;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:30,代码来源:GenericBinder.cs
示例5: AddNamedCommand
public Command AddNamedCommand(string commandName, string text, string tooltip,
ResourceBitmaps bitmapId, int status) {
ParameterModifier pm = new ParameterModifier(7);
for (int i = 0; i < 7; i++) {
pm[i] = false;
}
// the 7th argument is a ref parameter
pm[6] = true;
return (Command) commandsType.InvokeMember(
"AddNamedCommand2", BindingFlags.InvokeMethod, null,
commands, new object[] {
Context.AddInInstance,
commandName,
text,
tooltip,
true,
59,
contextGuids
// The status parameter is not passed (yet)
// VS 2005 beta2 breaks with this parameter
// we will add it when most people have switched to final
},
new ParameterModifier[] {pm}, null, null);
}
开发者ID:Dashboard-X,项目名称:JIRA_Connector_1.0.0_Beta_1,代码行数:26,代码来源:VSCommandBars.cs
示例6:
PropertyInfo IReflect.GetProperty(string name, BindingFlags bindingAttr,
Binder binder, Type returnType, Type[] types,
ParameterModifier[] modifiers)
{
return this.GetType().GetProperty(name, bindingAttr, binder,
returnType, types, modifiers);
}
开发者ID:Remy-Burney-Powerfront,项目名称:aspnet-redis-providers,代码行数:7,代码来源:RedisASPSessionDispatch.cs
示例7: BindToMethod
public override MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state)
{
object[] array = new object[args.Length];
args.CopyTo(array, 0);
state = null;
try
{
return this.defltBinder.BindToMethod(bindingAttr, match, ref args, modifiers, culture, names, out state);
}
catch (MissingMethodException)
{
if ((match != null) && (match.Length != 0))
{
for (int i = 0; i < match.Length; i++)
{
ParameterInfo[] parameters = match[i].GetParameters();
if (parameters.Length == array.Length)
{
for (int j = 0; j < parameters.Length; j++)
{
if (!parameters[j].ParameterType.IsInstanceOfType(array[j]) && (!parameters[j].ParameterType.IsArray || (array[j] != null)))
{
break;
}
if ((j + 1) == parameters.Length)
{
return match[i];
}
}
}
}
}
}
return null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:ExternalDataExchangeBinder.cs
示例8: GetMethod
public string GetMethod(string methodName, params IType[] args)
{
if (args.Any(a => a as AsmType == null))
return null;
var types = args.Select(t => (t as AsmType).Type).ToArray();
MethodInfo method = null;
if (args.Length > 0)
{
var modifiers = args.Select(arg => arg.Modifier == TypeModifier.Reference).ToArray();
var mods = new ParameterModifier[] { new ParameterModifier(modifiers.Length) };
for (var i = 0; i < modifiers.Length; i++)
mods[0][i] = modifiers[i];
method = Type.GetMethod(methodName, types, mods);
}
else
method = Type.GetMethod(methodName);
if (method == null)
return null;
var returnType = new AsmType(method.ReturnType);
var parameters = method.GetParameters()
.Select(p => new AsmType(p.ParameterType));
return string.Format("{0} {1}::{2}({3})",
returnType.Name, Name, methodName,
string.Join(", ", parameters.Select(p => p.Name)));
}
开发者ID:noahmorrison,项目名称:swish,代码行数:31,代码来源:AsmType.cs
示例9: BindToMethod
// Bind a set of arguments to a method.
public abstract MethodBase BindToMethod(BindingFlags bindingAttr,
MethodBase[] match,
ref Object[] args,
ParameterModifier[] modifiers,
CultureInfo culture,
String[] names,
ref Object state);
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:Binder.cs
示例10: ProcessRequest
/// <summary>
/// Process client request
/// </summary>
/// <param name="arguments">Query string parameters</param>
/// <param name="request">Http context request</param>
/// <returns>Number indicated http-request code (for exmpl. 200, 404, 403, 500)</returns>
public virtual Int32 ProcessRequest(String[] arguments, System.Web.HttpRequest request)
{
String methodName = String.Concat("action_", arguments[0]);
Type[] methodArgs1 = new Type[] { typeof(String[]) };
Type[] methodArgs0 = new Type[0];
ParameterModifier[] modifier = new ParameterModifier[0];
BindingFlags bflags = BindingFlags.IgnoreCase | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
// метод с параметром
MethodInfo method = this.GetType().GetMethod(methodName, bflags, Type.DefaultBinder, methodArgs1, modifier)
?? this.GetType().GetMethod(methodName, bflags, Type.DefaultBinder, methodArgs0, modifier);
if (method == null)
{
return 404;
}
try
{
return (Int32)method.Invoke(this, method.GetParameters().Length == 0 ? null : new Object[] {arguments});
}
catch (Exception excpn)
{
Logger.Error(this.GetType(), String.Format("Failed to invoke {0} method", methodName), excpn);
return 500;
}
}
开发者ID:dancecoder,项目名称:NStag-Web-Framework,代码行数:33,代码来源:BaseController.cs
示例11: SelectMethod
public override MethodBase SelectMethod(BindingFlags bindingAttr,
MethodBase[] match,
Type[] types,
ParameterModifier[] modifiers)
{
// TODO
return null;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:DefaultBinder.cs
示例12: GetMethodValidated
internal static MethodInfo GetMethodValidated(this Type type, string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
{
MethodInfo mi = type.GetMethod(name, bindingAttr, binder, types, modifiers);
if (!mi.MatchesArgumentTypes(types))
{
return null;
}
return mi;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:TypeExtensions.cs
示例13:
// Invoke a specific type member.
public override Object InvokeMember
(String name, BindingFlags invokeAttr, Binder binder,
Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)
{
return builder.InvokeMember(name, invokeAttr, binder,
target, args, modifiers,
culture, namedParameters);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:10,代码来源:EnumBuilder.cs
示例14: GetConstructorImpl
protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
Binder binder,
CallingConventions callConvention,
Type[] types,
ParameterModifier[] modifiers)
{
ConstructorInfo[] methods = GetConstructors (bindingAttr);
return GetConstructorImpl (methods, bindingAttr, binder, callConvention, types, modifiers);
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:MonoType.cs
示例15: InvokeMember
internal object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters)
{
Type type = base.GetType();
if (!type.IsCOMObject)
{
throw new InvalidOperationException(Environment.GetResourceString("Arg_InvokeMember"));
}
return type.InvokeMember(name, invokeAttr, binder, this, args, modifiers, culture, namedParameters);
}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:9,代码来源:MarshalByRefObject.cs
示例16: SelectProperty
public override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match,
Type returnType, Type[] indexes, ParameterModifier[] modifiers)
{
if (match.Length == 0)
{
return null;
}
return match[0];
}
开发者ID:mlnlover11,项目名称:MP.LSharp,代码行数:9,代码来源:Binder.cs
示例17: GetPropertyImpl
protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
{
PropertyInfo info = base.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers);
if (name == "ItemTemplate")
info = new FakePropertyInfo(info, this.listViewItemType);
return info;
}
开发者ID:dpawatts,项目名称:zeus,代码行数:9,代码来源:TypedListViewFakeType.cs
示例18: SelectMethod
public override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match,
Type[] types, ParameterModifier[] modifiers)
{
if (match.Length == 0)
{
return null;
}
return match[0];
}
开发者ID:mlnlover11,项目名称:MP.LSharp,代码行数:9,代码来源:Binder.cs
示例19: SelectMethod
public override MethodBase SelectMethod(
BindingFlags bindingAttr,
MethodBase[] match,
Type[] types,
ParameterModifier[] modifiers
)
{
throw new NotImplementedException();
}
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:9,代码来源:DomainBinder.cs
示例20: SelectProperty
public override PropertyInfo SelectProperty(
BindingFlags bindingAttr,
PropertyInfo[] match,
Type returnType,
Type[] indexes,
ParameterModifier[] modifiers
)
{
throw new NotImplementedException();
}
开发者ID:jiangguang5201314,项目名称:VMukti,代码行数:10,代码来源:DomainBinder.cs
注:本文中的System.Reflection.ParameterModifier类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论