本文整理汇总了C#中System.Reflection.MemberInfo.GetSignature方法的典型用法代码示例。如果您正苦于以下问题:C# MemberInfo.GetSignature方法的具体用法?C# MemberInfo.GetSignature怎么用?C# MemberInfo.GetSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.MemberInfo
的用法示例。
在下文中一共展示了MemberInfo.GetSignature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: interfaceContainsMember
private static bool interfaceContainsMember(Type interfaceType,
MemberInfo member)
{
return interfaceType.GetMethods().Select(
m => m.GetSignature()
).Contains(member.GetSignature());
}
示例2: RegisterDotNetNative
public void RegisterDotNetNative(MemberInfo member, JSNative attribute) {
List<MemberInfo> members;
#if VALIDATION
if (attribute.CallType != NativeCallType.Default && member is MethodBase && ((MethodBase)member).IsVirtual) {
ThrowHelper.Throw("JSNative::CallType cannot be set for {0} since it is virtual.", member.GetSignature());
}
#endif
if (member.DeclaringType.IsGenericTypeDefinition) {
if (!dotNetNativeMembersForType.TryGetValue(member.DeclaringType, out members)) {
members = new List<MemberInfo>();
dotNetNativeMembersForType[member.DeclaringType] = members;
}
dotNetNativeMembersForType[member.DeclaringType].Add(member);
}
dotNetNatives[member] = attribute;
}
示例3: GetNative
public JSNative GetNative(MemberInfo member) {
var attribtes = member.GetCustomAttributes(typeof(JSNative), true);
if (attribtes.Length == 1) {
return (JSNative)attribtes[0];
} else {
JSNative attribute;
if (dotNetNatives.TryGetValue(member, out attribute))
return attribute;
else if (member is MethodInfo) {
var methodInfo = (MethodInfo)member;
MethodInfo degenericMethod = null;
if (methodInfo.IsGenericMethod && dotNetNatives.TryGetValue(methodInfo.GetGenericMethodDefinition(), out attribute)) {
return attribute;
} else if (methodInfo.DeclaringType.IsGenericType) {
degenericMethod = GetMethodOfGenericTypeThatMatch(methodInfo);
if (degenericMethod != null && dotNetNatives.TryGetValue(degenericMethod, out attribute)) {
return attribute;
}
}
foreach (var @interface in methodInfo.DeclaringType.GetInterfaces()) {
var mapping = methodInfo.DeclaringType.GetInterfaceMap(@interface);
for (int i = 0; i < mapping.InterfaceMethods.Length; ++i) {
if (mapping.TargetMethods[i] == methodInfo || mapping.TargetMethods[i] == degenericMethod)
try {
return GetNative(mapping.InterfaceMethods[i]);
} catch { }
}
}
//zeby np nie natiwowac ciagle X.ToString : Object.ToString
var baseDefinition = methodInfo.GetBaseDefinition();
if (baseDefinition != methodInfo) {
try {
return GetNative(baseDefinition);
} catch { }
}
} else if (member is ConstructorInfo) {
var constructorInfo = (ConstructorInfo)member;
if (constructorInfo.DeclaringType.IsGenericType &&
dotNetNatives.TryGetValue(
constructorInfo.DeclaringType.GetGenericTypeDefinition().GetConstructor(
(from p in constructorInfo.GetParameters() select p.ParameterType).ToArray()
),
out attribute)
) {
return attribute;
}
}
ThrowHelper.Throw("Cannot resolve native {0}.", member.GetSignature());
return null;
}
}