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


C# IReflect.GetMethods方法代码示例

本文整理汇总了C#中IReflect.GetMethods方法的典型用法代码示例。如果您正苦于以下问题:C# IReflect.GetMethods方法的具体用法?C# IReflect.GetMethods怎么用?C# IReflect.GetMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IReflect的用法示例。


在下文中一共展示了IReflect.GetMethods方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompareTypes

        private static IEnumerable<string> CompareTypes(IReflect type1, IReflect type2, BindingFlags bindingFlags)
        {
            MethodInfo[] typeTMethodInfo = type1.GetMethods(bindingFlags);
            MethodInfo[] typeXMethodInfo = type2.GetMethods(bindingFlags);

            return typeTMethodInfo.Select(x => x.Name)
                                  .Except(typeXMethodInfo.Select(x => x.Name));
        }
开发者ID:CL0SeY,项目名称:RestSharp,代码行数:8,代码来源:InterfaceImplementationTests.cs

示例2: GetMethodExtended

       private static object GetMethodExtended(
 IReflect type,
 string name,
 bool staticMethod,
 int parameterCount)
       {
           var haveMethodName = false;
             BindingFlags flags = (staticMethod ? BindingFlags.Static :
           BindingFlags.Instance) | BindingFlags.Public |
           BindingFlags.NonPublic | BindingFlags.InvokeMethod;
             foreach (var method in type.GetMethods(flags)) {
           if (method.Name.Equals(name)) {
             haveMethodName = true;
             if (method.GetParameters().Length == parameterCount) {
           return method;
             }
           }
             }
             return haveMethodName ? type.GetMethod(name, flags) : null;
       }
开发者ID:peteroupc,项目名称:CBOR,代码行数:20,代码来源:Reflect.cs

示例3: AllMethodsFrom

 private static IEnumerable<MethodInfo> AllMethodsFrom(IReflect type)
 {
     return type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
 }
开发者ID:pete-restall,项目名称:Ichnaea,代码行数:4,代码来源:WovenEventSourcingMethodPropertiesTest.cs

示例4: MethodInfoCache

 private MethodInfoCache(IReflect type)
 {
     Methods = type.GetMethods(SimpleReflection.BindingFlags);
     _methods = Methods.GroupBy(x => x.Name).ToDictionary(x => x.Key, x => x.ToArray(), StringComparer.Ordinal);
 }
开发者ID:respu,项目名称:SimplyFast,代码行数:5,代码来源:MethodInfoCache.cs

示例5: GetMethods

		private static IEnumerable<string> GetMethods(IReflect myType, BindingFlags flags)
		{
			var methods = myType.GetMethods(flags).Where(info => !info.IsSpecialName).ToList();
			foreach (var methodInfo in methods)
			{
				var type = ToPrettyString(methodInfo.ReturnType);
				if (!returnTypeDictionary.ContainsKey(type))
					returnTypeDictionary[type] = new List<string>();
				returnTypeDictionary[type].Add(methodInfo.Name);
			}
			return methods.Select(x => x.Name).Distinct();
		}
开发者ID:andgein,项目名称:uLearn,代码行数:12,代码来源:CsCompleterGenerator.cs

示例6: GetExtensionMethods

		private static void GetExtensionMethods(IReflect type)
		{
			var methods = type
				.GetMethods(BindingFlags.Public | BindingFlags.Static)
				.Where(info => info.IsDefined(typeof(ExtensionAttribute), true))
				.Where(info => info.GetParameters().Length > 0);
			foreach (var info in methods)
			{
				var t = info.GetParameters()[0].ParameterType;
				if (t.IsGenericType)
					t = t.GetGenericTypeDefinition();
				if (!extensionMethods.ContainsKey(t))
					extensionMethods[t] = new HashSet<Tuple<string, string>>();
				var returnType = info.ReturnParameter == null ? "null" : ToPrettyString(info.ReturnParameter.ParameterType);
				extensionMethods[t].Add(Tuple.Create(info.Name, returnType));
			}
		}
开发者ID:andgein,项目名称:uLearn,代码行数:17,代码来源:CsCompleterGenerator.cs

示例7: GetMethod

		private MethodInfo GetMethod(IReflect viewModelType, string actionName)
		{
			var methodInfo =
				viewModelType
					.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
					.SingleOrDefault(
						method =>
							method.Name == actionName &&
							method.GetParameters().Count() <= 1);

			return methodInfo;
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:12,代码来源:CommandConvention.cs

示例8: GetRestOperations

		private static IEnumerable<MethodInfo> GetRestOperations(IReflect type)
		{
			return type
				.GetMethods(BindingFlags.Instance | BindingFlags.Public)
				.Where(m => m.HasAttribute<RestOperationAttribute>());
		}
开发者ID:typesafe,项目名称:RESTful-ASP.Net-MVC,代码行数:6,代码来源:RouteExtensions.cs


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