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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -