当前位置: 首页>>代码示例>>C#>>正文


C# MemberInfo.GetSignature方法代码示例

本文整理汇总了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());
 }
开发者ID:cheshire137,项目名称:ImplementsAttribute,代码行数:7,代码来源:ImplementsChecker.cs

示例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;
		}
开发者ID:JimmyJune,项目名称:il2js,代码行数:18,代码来源:JSCompiler.cs

示例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;
			}
		}
开发者ID:JimmyJune,项目名称:il2js,代码行数:51,代码来源:JSCompiler.cs


注:本文中的System.Reflection.MemberInfo.GetSignature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。