ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver.GetExtensionMethods C# (CSharp) Method

GetExtensionMethods() private method

private GetExtensionMethods ( ICSharpCode.NRefactory.CSharp.Resolver.MemberLookup lookup, INamespace ns ) : IEnumerable
lookup ICSharpCode.NRefactory.CSharp.Resolver.MemberLookup
ns INamespace
return IEnumerable
		IEnumerable<IMethod> GetExtensionMethods(MemberLookup lookup, INamespace ns)
		{
			// TODO: maybe make this a property on INamespace?
			return
				from c in ns.Types
				where c.IsStatic && c.HasExtensionMethods && c.TypeParameters.Count == 0 && lookup.IsAccessible(c, false)
				from m in c.Methods
				where m.IsExtensionMethod
				select m;
		}
		#endregion

Same methods

CSharpResolver::GetExtensionMethods ( IType targetType, string name = null, IList typeArguments = null, bool substituteInferredTypes = false ) : List>
CSharpResolver::GetExtensionMethods ( string name = null, IList typeArguments = null ) : List>

Usage Example

 /// <summary>
 /// Gets all candidate extension methods.
 /// Note: this includes candidates that are not eligible due to an inapplicable
 /// this argument.
 /// The candidates will only be specialized if the type arguments were provided explicitly.
 /// </summary>
 /// <remarks>
 /// The results are stored in nested lists because they are grouped by using scope.
 /// That is, for "using SomeExtensions; namespace X { using MoreExtensions; ... }",
 /// the return value will be
 /// new List {
 ///    new List { all extensions from MoreExtensions },
 ///    new List { all extensions from SomeExtensions }
 /// }
 /// </remarks>
 public IEnumerable <IEnumerable <IMethod> > GetExtensionMethods()
 {
     if (resolver != null)
     {
         Debug.Assert(extensionMethods == null);
         try {
             extensionMethods = resolver.GetExtensionMethods(methodName, typeArguments);
         } finally {
             resolver = null;
         }
     }
     return(extensionMethods ?? Enumerable.Empty <IEnumerable <IMethod> >());
 }
All Usage Examples Of ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver::GetExtensionMethods
CSharpResolver