ndependcqlinq

CQLINQ for list of methods returning a specific type or interface?


What is the CQLINQ to get list of methods returning a (compatible) specific type or interface?


Solution

  • You can get inspiration from such query:

    let listOfT = ThirdParty.Types.WithFullName(
    "System.Collections.Generic.IList<T>").Single()
    
    let compatibleTypes = listOfT.TypesThatImplementMe.Concat(listOfT)
    
    from m in Methods.Where(m => m.ReturnType != null && compatibleTypes.Contains(m.ReturnType))
    select new { m, m.ReturnType }