ServiceProviders 类

定义

使用可以添加服务的方法来提供 IServiceProvider 接口的实现。Provides an implementation for the IServiceProvider interface with methods that enable adding services.

public ref class ServiceProviders : IServiceProvider
[System.ComponentModel.Browsable(false)]
public class ServiceProviders : IServiceProvider
type ServiceProviders = class
    interface IServiceProvider
Public Class ServiceProviders
Implements IServiceProvider
继承
ServiceProviders
派生
属性
实现

注解

这是一个用于序列化内容时使用的实用工具类。This is a utility class for use when serializing content. 类基本上是一个仅限输入的字典, 用于存储由其服务类型键控的服务, IServiceProvider后者实现以后从同一字典中进行检索。The class is basically an input-only dictionary for storing services keyed by their service type, which implements IServiceProvider for later retrieval from the same dictionary. 使用字典可避免重复查询相同的服务。Using the dictionary avoids querying for the same service repeatedly. 此类是的基类XamlDesignerSerializationManager, 它是ShouldSerialize用于 WPF 其他部分中的方法实现的服务。This class is the base class of XamlDesignerSerializationManager, which is the service used for ShouldSerialize method implementations in other parts of WPF.

使用此类需要引用 WPF 程序集, 该程序集并不用于常规 .NET Framework XAML 服务方案。Using this class requires referencing WPF assemblies, it is not intended for general .NET Framework XAML Services scenarios. 此处的方案适用于 WPF 内部实现的服务密集型功能在序列化期间的内部实现, 如ShouldSerialize处理某些类型的实现时。The scenario here is for WPF internal implementation of service-intensive features during serialization, such as when processing the ShouldSerialize implementations of certain types. 此方案中涉及的实际类是派生类XamlDesignerSerializationManagerThe practical class involved in this scenario is the derived class XamlDesignerSerializationManager.

构造函数

ServiceProviders()

初始化 ServiceProviders 类的新实例。Initializes a new instance of the ServiceProviders class.

方法

AddService(Type, Object)

将服务添加到列表。Adds a service to the list.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetService(Type)

获取指定类型的服务对象。Gets the service object of the specified type.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于