How can I save the result of my query as a list?

So you can use the ToList<T>() extension method of the System.Linq namespace:

    public static IList<String> GetModificationFilesBetweenDates(String searchPath, DateTime fromDate, DateTime toDate)

        IEnumerable<String> select = (from file in GetAllFilesInPath(searchPath)
                                      where file.ScriptType == SQLFileType.Create
                                      && file.FromDate >= fromDate
                                      && file.ToDate <= toDate
                                      select file.FileName);
        return select.ToList();

Browse More Popular Posts

Leave a Comment