共用方式為


ProvideObjectAttribute(Type) Constructor

Definition

This constructor creates a new ProvideObjectAttribute object with the given object type.

public:
 ProvideObjectAttribute(Type ^ objectType);
public:
 ProvideObjectAttribute(Platform::Type ^ objectType);
public ProvideObjectAttribute (Type objectType);
new Microsoft.VisualStudio.Shell.ProvideObjectAttribute : Type -> Microsoft.VisualStudio.Shell.ProvideObjectAttribute
Public Sub New (objectType As Type)

Parameters

objectType
Type

The type of object that the VSPackage can create. This type can have any scoping (public, internal, etc.) but must have a public constructor that takes no arguments.

Examples

The following C# code applies the ProvideObject attribute to a VSPackage named MyVSPackage.

using Microsoft.VisualStudio.Shell;  
using MSVSIP = Microsoft.VisualStudio.Shell;  
[MSVSIP.ProvideObject(typeof(MyObject))]  
public class MyVSPackage : MSVSIP. Package {}  

Remarks

Any object proffered via the ProvideObjectAttribute class must have a public constructor. The constructor can be overloaded, but it must have at least one implementation that takes no arguments.

The C# language automatically appends the word "Attribute" to the name of any attribute class. In C# code, refer to this attribute as ProvideObject.

Applies to