Freigeben über


ProvideObjectAttribute Constructor

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

Namespace:  Microsoft.VisualStudio.Shell
Assemblies:   Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)

Syntax

'Declaration
Public Sub New ( _
    objectType As Type _
)
'Usage
Dim objectType As Type

Dim instance As New ProvideObjectAttribute(objectType)
public ProvideObjectAttribute(
    Type objectType
)
public:
ProvideObjectAttribute(
    Type^ objectType
)
new : 
        objectType:Type -> ProvideObjectAttribute
public function ProvideObjectAttribute(
    objectType : Type
)

Parameters

  • objectType
    Type: System.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.

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.

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 {}

.NET Framework Security

See Also

Reference

ProvideObjectAttribute Class

ProvideObjectAttribute Members

Microsoft.VisualStudio.Shell Namespace