共用方式為


RegistrationAttribute.Key Class

Provides an abstract class that represents a registration key.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Shell.RegistrationAttribute.Key

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.Immutable.10.0 (in Microsoft.VisualStudio.Shell.Immutable.10.0.dll)

Syntax

'宣告
Public MustInherit Class Key _
    Implements IDisposable
public abstract class Key : IDisposable

The RegistrationAttribute.Key type exposes the following members.

Constructors

  Name Description
Protected method RegistrationAttribute.Key Creates a new RegistrationAttribute.Key object.

Top

Methods

  Name Description
Public method Close Closes a key after writing is complete.
Public method CreateSubkey Creates a new registration key. The new key is a subkey of the current Key.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method SetValue Sets the name to the given value.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IDisposable.Dispose Disposes the object and its resources.

Top

Remarks

When to Implement

Registration tools (such as regpkg.exe) that use the information provided by the registration attribute classes must implement this class, RegistrationAttribute.Key, as well as RegistrationAttribute.RegistrationContext.

Basic Usage

A RegistrationAttribute.Key object is created by a registration utility such as regpkg.exe. The RegistrationAttribute.Key can represent an actual registry key, or it can represent information in a .reg or .vrg file.

When the registration utility registers a managed package assembly, it uses reflection to search the assembly for attribute classes that implement RegistrationAttribute.Key. The RegistrationAttribute.Key object is placed into a RegistrationAttribute.RegistrationContext object and passed to the Register method (or Unregister) method of the attribute class.

The attribute class uses the information in the RegistrationAttribute.Key and RegistrationAttribute.RegistrationContext objects to actually carry out the necessary registration tasks.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Shell Namespace

RegistrationAttribute

RegistrationAttribute.RegistrationContext

Other Resources

Managed VSPackage Registration Keys

Registering VSPackages