Szerkesztés

Megosztás a következőn keresztül:


ToolboxItemContainer Class

Definition

Encapsulates a ToolboxItem.

public ref class ToolboxItemContainer : System::Runtime::Serialization::ISerializable
[System.Serializable]
public class ToolboxItemContainer : System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type ToolboxItemContainer = class
    interface ISerializable
Public Class ToolboxItemContainer
Implements ISerializable
Inheritance
ToolboxItemContainer
Attributes
Implements

Remarks

ToolboxItemContainer is a simple class that encapsulates a ToolboxItem for efficiency. By having a single class that is always loaded, you can defer the loading of the ToolboxItem until it is needed. Because new classes can be derived from ToolboxItem, you could load a ToolboxItem that could, in turn, load an assembly that is not already in memory. For a large collection of ToolboxItem objects, this could cause a large number of assemblies to be loaded, which decreases performance. Instead, the toolbox service deals only with ToolboxItemContainer objects and retrieves their contained ToolboxItem only when necessary.

The ToolboxItemContainer is designed to hold any cached data from the ToolboxItem. The default implementation only holds the filter of the ToolboxItem, but deriving classes may choose to cache the name, image, and other information. ToolboxItemContainer objects support two forms of serialization: they can be serialized through standard runtime serialization, and they can also load and save themselves from a System.Windows.Forms.IDataObject. The former provides a very easy way to save ToolboxItemContainer objects to a persistent storage. The latter provides a way to integrate ToolboxItemContainer objects with mixed data storage formats.

Constructors

ToolboxItemContainer(IDataObject)

Initializes a new instance of the ToolboxItemContainer class from a IDataObject.

ToolboxItemContainer(SerializationInfo, StreamingContext)

Initializes a new instance of the ToolboxItemContainer class from a serialization stream.

ToolboxItemContainer(ToolboxItem)

Initializes a new instance of the ToolboxItemContainer class from a ToolboxItem.

Properties

IsCreated

Gets a value indicating whether the underlying toolbox item has been deserialized.

IsTransient

Gets a value indicating if the ToolboxItem contained in the ToolboxItemContainer is transient.

ToolboxData

Gets an IDataObject that describes this ToolboxItemContainer.

Methods

Equals(Object)

Determines whether two ToolboxItemContainer instances are equal.

GetFilter(ICollection)

Returns a collection of ToolboxItemFilterAttribute objects that represent the current filter for the ToolboxItem.

GetHashCode()

Returns the hash code for this instance.

GetObjectData(SerializationInfo, StreamingContext)

Saves the serialization state for the object.

GetToolboxItem(ICollection)

Returns the ToolboxItem contained in the ToolboxItemContainer.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
UpdateFilter(ToolboxItem)

Merges the container's filter with the filter from the given item.

Explicit Interface Implementations

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

For a description of this member, see the GetObjectData(SerializationInfo, StreamingContext) method.

Applies to

See also