Thursday, March 10, 2011

Order of Parameters

I've been working on a project in which I retrieve all of the Instance and Type Parameters from an object and I've noticed something odd.

foreach (Parameter para in eCoreWall.Parameters)
  results += Util.GetParameterInformation(para, m_doc);

Each time I pull the parameters, they are listed in a different order.  Anyone know why?
Here's an abbreviated example:

1st Time- 
Area: 27.72 SF
Length: 59.00
Function: Exterior

2nd Time-
Length: 59.00
Area: 27.72 SF
Function: Exterior

1 comment:

  1. Because it's executing an IEnumerable; it does not contain an order.

    The same behaviour appears for other enumerables and is by design. If you don't want that simply don't use an enumerable, but an array.