Free Support Forum - aspose.com

Please add implementation from IEnumerable<T> to Worksheets- Range and etc. classes

Hi,
My second suggestion (first):

Add implementation from IEnumerable interface to Range, Worksheets and all some cases in your API - it not a big deal, but it’s real helpful for using API.

Some points:
1) We can use LINQ extensions after that;
Before(we need to find all worksheets with Name starts “A”):

Workbook workbook = …;

List worksheetsStartsWithA= new List();
foreach(Worksheet worksheet in workbook.Worksheets)
{
if(worksheet.Name.StartsWith(“A”))
{
worksheetsStartsWithA.Add(worksheet);
}
}

After(we need to find all worksheets with Name starts “A”):

Workbook workbook = …;



List worksheetsStartsWithA=workbook.Worksheets.All(worksheet => worksheet.Name.StartsWith(“A”));


2) we can use var keyword in foreach(you don’t need to know type of returns objects)

Before:
Range range = …;
foreach(Cell cell in range) //I need type Cell manual and I need to know what type will be return, or cell will be object class
{

}

After:
foreach(var cell in range) //I don’t need to know type of return and var will be correct converted to Cell by compiler

{



}



3) More friendly intellisense


IEnumerable interface from .NET 2.0 - so, you don’t lost any platform support

Hi,

I have forwarded your comments/suggestions to our development team. They will look into them and implement it.

This issue has been logged as CELLSNET-40028.