c# - Cannot convert IQueryable<IEnumerable<string>> to return type IEnumerable<string> -
in following function error when try return value saying:
cannot convert
system.linq.iqueryable<system.collections.generic.ienumerable<string>>return typesystem.collections.generic.ienumerable<string>
public ienumerable<string> getmodulekindpropertynames(long modulekindid) {     var configurationid = getmodulekindpertypeconfigurationid(modulekindid);     var propertynames = _dbsis.modulekinds                               .where(t => t.pertypeconfigurationid == configurationid)                               .select(x => x.pertypeconfiguration.properties                               .select(z => z.name));      return propertynames; //red line below property names }   how can solve issue?
it looks want select items a collection within collection , flatten result single sequence.
conceptually, like:

if that's case, you're looking selectmany method:
var propertynames = _dbsis.modulekinds                           .where(t => t.pertypeconfigurationid == configurationid)                           .selectmany(x => x.pertypeconfiguration.properties)                           .select(z => z.name);      
Comments
Post a Comment