Hi,
Playing with some C# code here, I noticed the 'ObjectId.GetObject' statement runs faster than the 'Transaction.GetObject' one.
Example, I have to convert DBPoint ObjectId array (ids) into a Point3d array (pts), within a transaction (tr), doing:
Point3d[] pts = Array.ConvertAll<ObjectId, Point3d>(
isd, x => ((DBPoint)x.GetObject(OpenMode.ForRead)).Position);
runs 2 times faster than:
Point3d[] pts = Array.ConvertAll<ObjectId, Point3d>(
isd, x => ((DBPoint)tr.GetObject(x, OpenMode.ForRead)).Position);
But is it as safe ?
The help says ObjectId.GetObject calls the TransactionManager.GetObject() method of the top transaction.
As far as I understand, objects which are opened with Transaction.GetObject are closed and disposed at the end of the transaction.
Is it the same for objects opened through ObjectId.GetObject or do they need to be explicitly disposed ?