linq equals null error RRS feed

  • Question

  • User-974983964 posted
    IEnumerable<MethodBase> methods = from p in defaultMembers.OfType<PropertyInfo>()
    select p.GetGetMethod() into m
     where m != null
     select m

    ERROR: Unable to convert type“System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo>” to “System.Collections.Generic.IEnumerable<System.Reflection.MethodBase>”

    Friday, December 11, 2015 8:24 AM


  • User1724605321 posted

    Hi Melody ,

    The error message is clear . The type is not match .You need to cast to the MethodBase type .

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 11, 2015 9:29 AM