/// <summary>
/// Returns list of popular searches
/// </summary>
public static string[] getPopularSearches(int SectionID, int MaxToFetch)
{
using (MainContext db = new MainContext())
{
return (from c in db.tblSearches where c.SectionID == SectionID && c.Featured select new[] { c.Term });
}
}
ho guardato le altre domande, ma sembrano essere leggermente diverso, ottengo l'errore:Linq ritorno array di stringhe
Cannot implicitly convert type 'System.Linq.IQueryable<string[]>' to 'string[]'
So che questo è probabilmente semplice, qualcuno potrebbe indicare che cosa c'è che non va qui per favore ?
C'è un motivo particolare per cui è necessario restituire un array? IEnumerable sarebbe preferibile nella maggior parte dei casi, a meno che il codice chiamante richiede espressamente un array (improbabile) –
MattDavey