tags:

views:

51

answers:

1

I'm using LinQToExcel to read my excel worksheets.ExcelQueryFactory has a method that returns a worksheet based on worksheet name(Only one value(Name) is allowed).There is also a method that returns WorkSheet names. Is there a way to use LinQ to select multiple worksheet collection based on names.

ExcelQueryFactory test = new ExcelQueryFactory(FilePath); List names = targetExcelFactory.GetWorksheetNames().ToList(); var sheet = test.Worksheet("sheet1");

A: 

Enumerable.Select lets you turn the result from one set into a completely other set aka projection.

var result = targetExcelFactory.GetWorksheetNames()
  .Select(name => test.Worksheet(name))
  .ToList();
David B