Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IBuildEngine4.RegisterTaskObject Method

.NET Framework 4.6 and 4.5

Registers an object with the system that will be disposed of at some specified time in the future.

Namespace:  Microsoft.Build.Framework
Assembly:  Microsoft.Build.Framework (in Microsoft.Build.Framework.dll)

void RegisterTaskObject(
	Object key,
	Object obj,
	RegisteredTaskObjectLifetime lifetime,
	bool allowEarlyCollection
)

Parameters

key
Type: System.Object

The key used to retrieve the object.

obj
Type: System.Object

The object to be held for later disposal.

lifetime
Type: Microsoft.Build.Framework.RegisteredTaskObjectLifetime

The lifetime of the object.

allowEarlyCollection
Type: System.Boolean

Flag that determines whether the object can be disposed earlier than the requested time.

This method may be called by tasks which need to maintain state across task invocations, such as data caching tasks. It is strongly recommended that allowEarlyCollection be set to true if the object will retain any significant amount of data.

The thread on which the object is disposed may be arbitrarily, but it will not be disposed while the task is executing, even if allowEarlyCollection is set to true.

If the object implements IDisposable, IDisposable.Dispose will be invoked on the object before discarding it.

.NET Framework

Supported in: 4.6, 4.5
Show:
© 2015 Microsoft