Package.CreateInstance Method
Creates the specified COM object using the Visual Studio's local registry CLSID object.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
'宣告
Public Function CreateInstance ( _
ByRef clsid As Guid, _
ByRef iid As Guid, _
type As Type _
) As Object
'用途
Dim instance As Package
Dim clsid As Guid
Dim iid As Guid
Dim type As Type
Dim returnValue As Object
returnValue = instance.CreateInstance(clsid, _
iid, type)
public Object CreateInstance(
ref Guid clsid,
ref Guid iid,
Type type
)
public:
Object^ CreateInstance(
Guid% clsid,
Guid% iid,
Type^ type
)
member CreateInstance :
clsid:Guid byref *
iid:Guid byref *
type:Type -> Object
public function CreateInstance(
clsid : Guid,
iid : Guid,
type : Type
) : Object
Parameters
- clsid
Type: System.Guid%
The CLSID of the object to create.
- iid
Type: System.Guid%
The interface IID the object implements.
- type
Type: System.Type
The managed type of the object to return.
Return Value
Type: System.Object
An instance of the created object.
Remarks
The CreateInstance method creates the specified object using the Visual Studio local registry CLSID object. After creation it is cast to the given type. If Visual Studio cannot create it for any reason, the package uses Activator.CreatInstance. This allows managed classes to be registered in local to the particular Visual Studio version in HKLM\Software\Microsoft\VisualStudio\8.0\clsid.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.