Jumpercables
Jan 13th, 2007, 01:42 AM
I was just curious if I should even bother with creating a new class to hold 2 parameters of information or just hold them in an array list.
Currently I am sorting information into any arraylist like the following.
ArrayList _route = new ArrayList();
_route.Add(1 + "|" + 2);
_route.Add(5 + "|" + 24);
_route.Add(123 + "|" + 12);
// etc...
Would it be "better" to use a class or structure and add it to the ArrayList, I only ask because it would reduce extra parsing when extracting the information but MOST importantly would it hinder the performance?
public class Path
{
private Int32 _clid, _oid;
public Path(Int32 CLID, Int32 OID)
{
this._clid = CLID;
this._oid = OID;
}
public Int32 CLID
{
get { return _clid; }
}
public Int32 OID
{
get { return _oid; }
}
}
// Add information to arraylist using the path class.
ArrayList _route = new ArrayList();
_route.Add(new Path(1, 2));
_route.Add(new Path(5, 24));
_route.Add(new Path(123,12));
// etc...
The Path class could be instantiated up to 100+ times.
Any ideas or thoughts would be great.
Currently I am sorting information into any arraylist like the following.
ArrayList _route = new ArrayList();
_route.Add(1 + "|" + 2);
_route.Add(5 + "|" + 24);
_route.Add(123 + "|" + 12);
// etc...
Would it be "better" to use a class or structure and add it to the ArrayList, I only ask because it would reduce extra parsing when extracting the information but MOST importantly would it hinder the performance?
public class Path
{
private Int32 _clid, _oid;
public Path(Int32 CLID, Int32 OID)
{
this._clid = CLID;
this._oid = OID;
}
public Int32 CLID
{
get { return _clid; }
}
public Int32 OID
{
get { return _oid; }
}
}
// Add information to arraylist using the path class.
ArrayList _route = new ArrayList();
_route.Add(new Path(1, 2));
_route.Add(new Path(5, 24));
_route.Add(new Path(123,12));
// etc...
The Path class could be instantiated up to 100+ times.
Any ideas or thoughts would be great.