dotMemory Unit
 
Get dotMemory Unit

Work with Object Sets

Last modified: 05 September 2023

Object set is a number of objects selected by specific condition. To ease the understanding, think of an object set as of the result of some query, like "Select all objects of the string type promoted to Gen 2", or "Select all objects retained in memory by the instance A", and so on. An ObjectSet instance is returned as a result of the ObjectSet.GetObjects and ObjectSet.GetExclusivelyRetainedObjects methods.

To slice data by a number of conditions, you can build chains of GetObjects calls. The ObjectSet type has two properties that you can use in test assertions: ObjectsCount and SizeInBytes.