Defines that no more than a specified number of instances of Types that matches the provided names (and optionally their subclasses) are allowed to exist when this definition is asserted using MemAssertion.Assert(MemSnapShot, AssertionsDefinition, AssertionsThread).

Namespace:  SciTech.NetMemProfiler
Assembly:  MemProfiler2 (in MemProfiler2.dll)

Syntax

C#
public void MaxInstances(
	string[] typeNames,
	bool includeSubclasses,
	int instanceCount
)
Visual Basic
Public Sub MaxInstances ( _
	typeNames As String(), _
	includeSubclasses As Boolean, _
	instanceCount As Integer _
)
Visual C++
public:
void MaxInstances(
	array<String^>^ typeNames, 
	bool includeSubclasses, 
	int instanceCount
)

Parameters

typeNames
Type: array<System..::..String>[]()[][]
An array containing the names of the Types that should be checked.
includeSubclasses
Type: System..::..Boolean
Indicates whether instances of subclasses of the specified types should be checked.
instanceCount
Type: System..::..Int32
Defines the maximum number of instances that are allowed to exist of the specified types.

Remarks

Calling MemAssertion.Assert(MemSnapShot, AssertionsDefinition, AssertionsThread) using this AssertionsDefinition will allow up to instanceCount instances of the specified types to exist. If more than instanceCount instances exist, then calling MemAssertion.Assert(MemSnapShot, AssertionsDefinition, AssertionsThread) using this AssertionsDefinition will fail.

See Also