Pablo Costa

Pablo Costa

  • NA
  • 24
  • 4.9k

Retrieve one item from array of lists(NOT ArrayList)

Feb 25 2016 3:54 PM
 
On my code, i've got an array of lists:
public class xmldatalist
{
public List<xmldata>[] XMLArrayList = new List<xmldata>[9999];
}
Each position on the list, contains a xmldata object (this class):
public class xmldata //Class to receive items list
{
public string xml_filename { get; set; }
public string colorname { get; set; }
public string colorvalues { get; set; }
}
Inside another method, i've got an loop to walk trough the non empty positions on this array of lists:
for(int n=0; n< GlobalVars.nonemptypos; n++)
{
}
Inside this loop, i would like to retrieve the current xml_filename being processed.
i.e: Position 0 of the list has a xml_filename called bla1.bla - i would like to retrieve this name.
I've tried a LINQ Approach:
string name = XMLList.XMLArrayList[n].Select(x => x.xml_filename);
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<string>' to 'string'
What i'm trying to achieve is obtain the current xml_filename on n(indexer) position.
I've made some research but everywhere talks about ArrayList() , not array of lists.
Any help is appreciated. Thanks.

Answers (1)