I have some code that loops through directories named for years (e.g. /2011/, /2012/ etc) which each contain files whose names end with dates in the yyyyMMdd format, and builds a list of all the dates in all the directories. But what is the best way to indent this, nothing I've tried is readable:files = files.Union(    Directory.GetFiles(year)             .Select(d => DateTime.ParseExact(      Path.GetFileNameWithoutExtension(d)          .Substring(         Path.GetFileNameWithoutExtension(d)             .Length - 8),     yyyyMMdd,     null))).ToList();orfiles = files.Union(Directory.GetFiles(year)                             .Select(d => DateTime.ParseExact(                                                              Path.GetFileNameWithoutExtension(d).Substring(                                                                                                    Path.GetFileNameWithoutExtension(d).Length - 8),                                                              yyyyMMdd,                                                              null)                                     )                    ).ToList();orfiles = files.Union(Directory.GetFiles(year)                             .Select(d => DateTime.ParseExact(                                                              Path.GetFileNameWithoutExtension(d).Substring(                                                                                                            Path.GetFileNameWithoutExtension(d).Length - 8),                                                              yyyyMMdd,                                                              null))).ToList();orfiles = files.Union(Directory.GetFiles(year).Select(d => DateTime.ParseExact(                    Path.GetFileNameWithoutExtension(d).Substring(                    Path.GetFileNameWithoutExtension(d).Length - 8),                    yyyyMMdd, null))).ToList();
Indentation on a long (ish) linq chain
c#;linq;comparative review
Naming As the purpose of this linq query is to build a List<DateTime> where you only need the Date part, a better name would be dates instead of files.  As year doesn't contain a year, but a foldername let us change the name to yearlyFolderName. RefactoringLet us introduce a method which will expect a folderName and a dateFormat each as String and returns a IEnumerable<DateTime>.  private IEnumerable<DateTime> GetDatesFromFileNames(String containingFolder, String datePattern){    return Directory.GetFiles(containingFolder)        .Select(s => Path.GetFileNameWithoutExtension(s))        .Select(s => s.Substring(s.Length - 8))        .Select(s => DateTime.ParseExact(s, datePattern, null));}  As we use a additional Select() to firstly get the filenames without extension, then using another Select() to get only the date part and last another Select() we can neat indent this linq query.we will add an overload to reflect your current dateformat also  private IEnumerable<DateTime> GetDatesFromFileNames(String containingFolder){    return GetDatesFromFileNames(containingFolder, yyyyMMdd);}  Now you can call it  dates = dates.Union(GetDatesFromFileNames(yearlyFolderName)).ToList();