It's probable the question of typization (in C++ with STL everything would be made through std::vector and no questions would appear).
I have an ArrayList and I'd like to store some structs there. Like
struct txtRange
{
public String sText;
public String sTag;
public int iBeg;
public int iEnd;
};
ArrayList Ranges = new ArrayList();
txtRange iRange;
iRange.sText = entityText;
iRange.sTag = "";
iRange.iBeg = Ranges.Count > 0 ? Ranges[Ranges.Count - 1].iEnd + 1 : 0;
iRange.iEnd = iRange.iBeg + tmpstr.Length;
Ranges.Add(iRange);
Actually, I have troubles when accessing Ranges[Ranges.Count - 1].iEnd: 'object' does not contain a definition for 'iEnd'. How should a ArrayList of the type specified be created?
The similar question (How to cast object/structure into arraylist?) made me laugh a bit... But still, there is an explanation how to add structures into ArrayList but not how to get the values from there.