共用方式為


ServiceProviderHierarchy Class

Acts as a hierarchical service provider.

Inheritance Hierarchy

Object
  SortedList<Int32, IServiceProvider>
    Microsoft.VisualStudio.Shell.ServiceProviderHierarchy

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Public NotInheritable Class ServiceProviderHierarchy _
    Inherits SortedList(Of Integer, IServiceProvider) _
    Implements IServiceProvider
public sealed class ServiceProviderHierarchy : SortedList<int, IServiceProvider>, 
    IServiceProvider
public ref class ServiceProviderHierarchy sealed : public SortedList<int, IServiceProvider^>, 
    IServiceProvider
[<Sealed>]
type ServiceProviderHierarchy =  
    class 
        inherit SortedList<int, IServiceProvider>
        interface IServiceProvider 
    end
public final class ServiceProviderHierarchy extends SortedList<int, IServiceProvider> implements IServiceProvider

The ServiceProviderHierarchy type exposes the following members.

Constructors

  Name Description
Public method ServiceProviderHierarchy Initializes a new instance of ServiceProviderHierarchy.

Top

Properties

  Name Description
Public property Capacity Gets or sets the number of elements that the SortedList can contain. (Inherited from SortedList<Int32, IServiceProvider>.)
Public property Comparer Gets the IComparer for the sorted list. (Inherited from SortedList<Int32, IServiceProvider>.)
Public property Count Gets the number of key/value pairs contained in the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public property Item Gets or sets the value associated with the specified key. (Inherited from SortedList<Int32, IServiceProvider>.)
Public property Keys Gets a collection containing the keys in the SortedList, in sorted order. (Inherited from SortedList<Int32, IServiceProvider>.)
Public property Values Gets a collection containing the values in the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)

Top

Methods

  Name Description
Public method Add Adds an element with the specified key and value into the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method Clear Removes all elements from the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method ContainsKey Determines whether the SortedList contains a specific key. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method ContainsValue Determines whether the SortedList contains a specific value. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method GetEnumerator Returns an enumerator that iterates through the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetService Gets a service of the specified type.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IndexOfKey Searches for the specified key and returns the zero-based index within the entire SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method IndexOfValue Searches for the specified value and returns the zero-based index of the first occurrence within the entire SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method Remove Removes the element with the specified key from the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method RemoveAt Removes the element at the specified index of the SortedList. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method TrimExcess Sets the capacity to the actual number of elements in the SortedList, if that number is less than 90 percent of current capacity. (Inherited from SortedList<Int32, IServiceProvider>.)
Public method TryGetValue Gets the value associated with the specified key. (Inherited from SortedList<Int32, IServiceProvider>.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method System#Collections#Generic#ICollection{T}#Add Adds a key/value pair to the ICollection. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#IDictionary#Add Adds an element with the provided key and value to the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#Generic#ICollection{T}#Contains Determines whether the ICollection contains a specific element. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#IDictionary#Contains Determines whether the IDictionary contains an element with the specified key. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#Generic#ICollection{T}#CopyTo Copies the elements of the ICollection to an Array, starting at a particular Array index. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#ICollection#CopyTo Copies the elements of the ICollection to an Array, starting at a particular Array index. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#Generic#IEnumerable{T}#GetEnumerator Returns an enumerator that iterates through a collection. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#IDictionary#GetEnumerator Returns an IDictionaryEnumerator for the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#IEnumerable#GetEnumerator Returns an enumerator that iterates through a collection. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#IDictionary#IsFixedSize Gets a value indicating whether the IDictionary has a fixed size. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#Generic#ICollection{T}#IsReadOnly Gets a value indicating whether the ICollection is read-only. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#IDictionary#IsReadOnly Gets a value indicating whether the IDictionary is read-only. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#ICollection#IsSynchronized Gets a value indicating whether access to the ICollection is synchronized (thread safe). (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#IDictionary#Item Gets or sets the element with the specified key. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#Generic#IDictionary{TKey@TValue}#Keys Gets an ICollection containing the keys of the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#IDictionary#Keys Gets an ICollection containing the keys of the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#Generic#ICollection{T}#Remove Removes the first occurrence of a specific key/value pair from the ICollection. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate method System#Collections#IDictionary#Remove Removes the element with the specified key from the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#ICollection#SyncRoot Gets an object that can be used to synchronize access to the ICollection. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#Generic#IDictionary{TKey@TValue}#Values Gets an ICollection containing the values in the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)
Explicit interface implemetationPrivate property System#Collections#IDictionary#Values Gets an ICollection containing the values in the IDictionary. (Inherited from SortedList<Int32, IServiceProvider>.)

Top

Remarks

It stores IServiceProvider objects in a sorted dictionary for an ordered retrieval. When GetService is called to retrieve a service, the service providers are queried in a specific order. This is useful when multiple service providers are combined such as in the WindowPane implementation.

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