// Copyright (c) 2010 AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) using System; using System.Collections.Generic; using System.Collections.ObjectModel; using ICSharpCode.NRefactory.TypeSystem; namespace ICSharpCode.NRefactory.CSharp.Resolver { /// /// Represents a group of methods. /// public class MethodGroupResolveResult : ResolveResult { readonly ReadOnlyCollection methods; readonly ReadOnlyCollection typeArguments; readonly IType targetType; readonly string methodName; /// /// List of extension methods, used to avoid re-calculating it in ResolveInvocation() when it was already /// calculated by ResolveMemberAccess(). /// internal List> ExtensionMethods; public MethodGroupResolveResult(IType targetType, string methodName, IList methods, IList typeArguments) : base(SharedTypes.UnknownType) { if (targetType == null) throw new ArgumentNullException("targetType"); if (methods == null) throw new ArgumentNullException("methods"); this.targetType = targetType; this.methodName = methodName; this.methods = new ReadOnlyCollection(methods); this.typeArguments = typeArguments != null ? new ReadOnlyCollection(typeArguments) : EmptyList.Instance; } public IType TargetType { get { return targetType; } } public string MethodName { get { return methodName; } } public ReadOnlyCollection Methods { get { return methods; } } public ReadOnlyCollection TypeArguments { get { return typeArguments; } } public override string ToString() { return string.Format("[{0} with {1} method(s)]", GetType().Name, methods.Count); } } }