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 type system.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:

example class diagram

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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -