range values into list via c#

M

mp

if c# questions are allowed here....?
is this ok way to get list of range values?
in my case i just have a 1D range A1:A15 for example
for 2D range i'd have to think of some other way I suppose

....where _xlRange is a private member var pointing to an excel range
public List<string> RangeValueList()
{
if (_xlRange != null)
{
List<string> rangeList = new List<string>();
foreach (Range cell in _xlRange)
{
rangeList.Add( cell.Value2 );
}
return rangeList;
}
return null;
}

also wondering why i only get Value2 on the cell, not Value (in list of
intellisense)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top