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


C# IReturnType.GetMethods方法代码示例

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


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

示例1: AddMethodsFromBaseType

		void AddMethodsFromBaseType(List<IMethod> l, IReturnType baseType)
		{
			if (baseType != null) {
				foreach (IMethod m in baseType.GetMethods()) {
					if (m.IsConstructor)
						continue;
					
					bool ok = true;
					if (m.IsOverridable) {
						StringComparer comparer = m.DeclaringType.ProjectContent.Language.NameComparer;
						foreach (IMethod oldMethod in c.Methods) {
							if (comparer.Equals(oldMethod.Name, m.Name)) {
								if (m.IsStatic == oldMethod.IsStatic && object.Equals(m.ReturnType, oldMethod.ReturnType)) {
									if (DiffUtility.Compare(oldMethod.Parameters, m.Parameters) == 0) {
										ok = false;
										break;
									}
								}
							}
						}
					}
					if (ok)
						l.Add(m);
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:26,代码来源:DefaultReturnType.cs

示例2: GetDelegateOrExpressionTreeSignature

 internal static IMethod GetDelegateOrExpressionTreeSignature(IReturnType rt, bool allowExpressionTree)
 {
     if (rt == null)
         return null;
     IClass c = rt.GetUnderlyingClass();
     if (allowExpressionTree && c != null && c.FullyQualifiedName == "System.Linq.Expressions.Expression") {
         ConstructedReturnType crt = rt.CastToConstructedReturnType();
         if (crt != null && crt.TypeArguments.Count == 1) {
             // get delegate type from expression type
             rt = crt.TypeArguments[0];
             c = rt != null ? rt.GetUnderlyingClass() : null;
         }
     }
     if (c != null && c.ClassType == ClassType.Delegate) {
         return rt.GetMethods().FirstOrDefault((IMethod m) => m.Name == "Invoke");
     }
     return null;
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:18,代码来源:TypeInference.cs

示例3: ResolveConstructorOverload

		internal ResolveResult ResolveConstructorOverload(IReturnType rt, List<Expression> arguments)
		{
			if (rt == null)
				return null;
			
			List<IMethod> methods = rt.GetMethods().Where(m => m.IsConstructor && !m.IsStatic).ToList();
			IReturnType[] argumentTypes = arguments.Select<Expression, IReturnType>(ResolveType).ToArray();
			bool resultIsAcceptable;
			IMethod result = MemberLookupHelper.FindOverload(methods, argumentTypes, out resultIsAcceptable);
			
			ResolveResult rr = CreateMemberResolveResult(result);
			if (rr != null)
				rr.ResolvedType = rt;
			return rr;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:15,代码来源:ResolveVisitor.cs

示例4: GetConstructors

		IEnumerable<IMethod> GetConstructors(IReturnType rt)
		{
			// no need to add default constructor here:
			// default constructors should already be present in rt.GetMethods()
			if (rt == null)
				return Enumerable.Empty<IMethod>();
			else
				return rt.GetMethods().Where(m => m.IsConstructor && !m.IsStatic);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:MethodInsightProvider.cs

示例5: ResolveMethodInType

		void ResolveMethodInType(IReturnType containingType, string methodName, ExpressionCollection arguments)
		{
			List<IMethod> methods = new List<IMethod>();
			bool isClassInInheritanceTree = false;
			if (callingClass != null)
				isClassInInheritanceTree = callingClass.IsTypeInInheritanceTree(containingType.GetUnderlyingClass());
			
			foreach (IMethod m in containingType.GetMethods()) {
				if (IsSameName(m.Name, methodName)
				    && m.IsAccessible(callingClass, isClassInInheritanceTree)
				   ) {
					methods.Add(m);
				}
			}
			if (methods.Count == 0) {
				List<IMethodOrProperty> list = new List<IMethodOrProperty>();
				ResolveResult.AddExtensions(callingClass.ProjectContent.Language, list.Add, callingClass, containingType);
				foreach (IMethodOrProperty mp in list) {
					if (IsSameName(mp.Name, methodName) && mp is IMethod) {
						IMethod m = (IMethod)mp.CreateSpecializedMember();
						m.Parameters.RemoveAt(0);
						methods.Add(m);
					}
				}
			}
			ResolveInvocation(methods, arguments);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:27,代码来源:ResolveVisitor.cs

示例6: ResolveMember

		bool ResolveMember(IReturnType type, string memberName)
		{
			ClearResult();
			if (type == null)
				return false;
			bool isClassInInheritanceTree = false;
			if (callingClass != null)
				isClassInInheritanceTree = callingClass.IsTypeInInheritanceTree(type.GetUnderlyingClass());
			foreach (IProperty p in type.GetProperties()) {
				if (IsSameName(p.Name, memberName)) {
					MakeResult(p);
					return true;
				}
			}
			foreach (IField f in type.GetFields()) {
				if (IsSameName(f.Name, memberName)) {
					MakeResult(f);
					return true;
				}
			}
			foreach (IEvent e in type.GetEvents()) {
				if (IsSameName(e.Name, memberName)) {
					MakeResult(e);
					return true;
				}
			}
			foreach (IMethod m in type.GetMethods()) {
				if (IsSameName(m.Name, memberName)) {
					MakeMethodResult(type, memberName);
					return true;
				}
			}
			if (callingClass != null) {
				List<IMethodOrProperty> list = new List<IMethodOrProperty>();
				ResolveResult.AddExtensions(callingClass.ProjectContent.Language, list.Add, callingClass, type);
				foreach (IMethodOrProperty mp in list) {
					if (IsSameName(mp.Name, memberName)) {
						if (mp is IMethod)
							MakeMethodResult(type, memberName);
						else
							MakeResult(mp);
						return true;
					}
				}
			}
			return false;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:47,代码来源:ResolveVisitor.cs

示例7: ResolvePropertyName

		MemberResolveResult ResolvePropertyName(IReturnType resolvedType, string propertyName, bool allowAttached)
		{
			IMember member = resolvedType.GetProperties().Find(delegate(IProperty p) { return p.Name == propertyName; });
			if (member == null) {
				member = resolvedType.GetEvents().Find(delegate(IEvent p) { return p.Name == propertyName; });
			}
			if (member == null && allowAttached) {
				IMethod method = resolvedType.GetMethods().Find(
					delegate(IMethod p) {
						return p.IsStatic && p.Parameters.Count == 1 && p.Name == "Get" + propertyName;
					});
				member = method;
				if (member != null) {
					member = new DefaultProperty(resolvedType.GetUnderlyingClass(), propertyName) { ReturnType = method.ReturnType };
				} else {
					IMethod m = resolvedType.GetMethods().Find(
						delegate(IMethod p) {
							return p.IsPublic && p.IsStatic && p.Parameters.Count == 2 && (p.Name == "Add" + propertyName + "Handler" || p.Name == "Remove" + propertyName + "Handler");
						});
					member = m;
					if (member != null)
						member = new DefaultEvent(resolvedType.GetUnderlyingClass(), propertyName) { ReturnType = m.Parameters[1].ReturnType };
				}
			}
			if (member != null)
				return new MemberResolveResult(callingClass, null, member);
			return null;
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:28,代码来源:XamlResolver.cs

示例8: DoPositionalArgsCompletion

		/// <remarks>returns true if elements from named args completion should be added afterwards.</remarks>
		static bool DoPositionalArgsCompletion(XamlCompletionItemList list, XamlCompletionContext context, MarkupExtensionInfo markup, IReturnType type)
		{
			switch (type.FullyQualifiedName) {
				case "System.Windows.Markup.ArrayExtension":
				case "System.Windows.Markup.NullExtension":
					// x:Null/x:Array does not need completion, ignore it
					break;
				case "System.Windows.Markup.StaticExtension":
					if (context.AttributeValue.ExtensionValue.PositionalArguments.Count <= 1)
						return DoStaticExtensionCompletion(list, context);
					break;
				case "System.Windows.Markup.TypeExtension":
					if (context.AttributeValue.ExtensionValue.PositionalArguments.Count <= 1) {
						list.Items.AddRange(GetClassesFromContext(context).FlattenToList());
						AttributeValue selItem = Utils.GetMarkupExtensionAtPosition(context.AttributeValue.ExtensionValue, context.ValueStartOffset)
							.PositionalArguments.LastOrDefault();
						string word = context.Editor.GetWordBeforeCaret().TrimEnd();
						if (selItem != null && selItem.IsString && word == selItem.StringValue) {
							list.PreselectionLength = selItem.StringValue.Length;
						}
					}
					break;
				default:
					var ctors = type.GetMethods()
						.Where(m => m.IsPublic && m.IsConstructor && m.Parameters.Count >= markup.PositionalArguments.Count + 1);
					if (context.Forced)
						return true;
					if (ctors.Any() || markup.PositionalArguments.Count == 0)
						return false;
					break;
			}
			
			return true;
		}
开发者ID:Dervall,项目名称:SharpDevelop,代码行数:35,代码来源:CompletionDataHelper.cs


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