1

I have the below LINQ, and I need the result returned as a List but I receive the error:

Cannot implicitly convert type System.Collections.Generic.IEnumerable<<anonymous type: string emis>> to System.Collections.Generic.List<string>. An explicit conversion exists (are you missing a cast?)

How can I return a List of strings?

List<string> emisList = (
    from p in subproductTypeyProduct
    join q in dbEntitiesParams.PARAM_Rule
    on new { p.ProductType, p.SubProductTypeCode }
    equals new { ProductType = q.ProductTypeCode, SubProductTypeCode = q.SubProductCode }
    select new { q.emis });

1 Answer 1

5

No need to project the anonymous type. Just the simple string. Replace select new { q.emis } with select q.emis.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.