SettingsProperty 类

定义

在内部作为类使用,表示有关个别配置属性的元数据。Used internally as the class that represents metadata about an individual configuration property.

public ref class SettingsProperty
public class SettingsProperty
type SettingsProperty = class
Public Class SettingsProperty
继承
SettingsProperty

注解

SettingsProperty 用于描述派生自的类的设置属性 SettingsBaseSettingsProperty is used to describe settings properties of a class derived from SettingsBase. Settings API 允许将设置属性的集合分组到公共语言运行时类中。The Settings API allows a collection of settings properties to be grouped into a common language runtime class.

保留设置时, SettingsBase 基类要求提供对象的集合,这些 SettingsProperty 对象在类型的集合中进行分组 SettingsPropertyCollectionWhen persisting settings, the SettingsBase base class asks for a collection of SettingsProperty objects, grouped in a collection of type SettingsPropertyCollection. 它通过调用其自身的属性成员来实现此功能。It does this by calling its own Properties member. 继承的类应返回要保存的属性的集合。Inherited classes should return a collection of properties to persist.

每个 SettingsProperty 对象都包含有关属性的元数据,包括以下内容:Each SettingsProperty object includes metadata about the property, including the following:

  • 名称:Name.

  • 默认值。Default value.

  • 属性类型。Property type.

  • 序列化方法。Serialization method.

  • 用于暂留的提供程序。Provider to use for persistence.

  • 特定于上下文和提供程序的其他任意属性。Other arbitrary attributes that are context and provider specific.

构造函数

SettingsProperty(SettingsProperty)

根据所提供的参数初始化 SettingsProperty 类的新实例。Initializes a new instance of the SettingsProperty class, based on the supplied parameter.

SettingsProperty(String)

初始化 SettingsProperty 类的新实例。Initializes a new instance of the SettingsProperty class. 根据提供的参数。based on the supplied parameter.

SettingsProperty(String, Type, SettingsProvider, Boolean, Object, SettingsSerializeAs, SettingsAttributeDictionary, Boolean, Boolean)

根据提供的参数创建 SettingsProperty 类的新实例。Creates a new instance of the SettingsProperty class based on the supplied parameters.

属性

Attributes

获取 SettingsAttributeDictionary 对象,该对象包含 SettingsProperty 对象的特性。Gets a SettingsAttributeDictionary object containing the attributes of the SettingsProperty object.

DefaultValue

获取或设置 SettingsProperty 对象的默认值。Gets or sets the default value of the SettingsProperty object.

IsReadOnly

获取或设置一个值,该值指定 SettingsProperty 对象是否为只读。Gets or sets a value specifying whether a SettingsProperty object is read-only.

Name

获取或设置 SettingsProperty 的名称。Gets or sets the name of the SettingsProperty.

PropertyType

获取或设置 SettingsProperty 的类型。Gets or sets the type for the SettingsProperty.

Provider

获取或设置 SettingsProperty 的提供程序。Gets or sets the provider for the SettingsProperty.

SerializeAs

获取或设置 SettingsSerializeAsSettingsProperty 对象。Gets or sets a SettingsSerializeAs object for the SettingsProperty.

ThrowOnErrorDeserializing

获取或设置一个值,该值指定未成功反序列化属性时是否引发错误。Gets or sets a value specifying whether an error will be thrown when the property is unsuccessfully deserialized.

ThrowOnErrorSerializing

获取或设置一个值,该值指定未成功序列化属性时是否引发错误。Gets or sets a value specifying whether an error will be thrown when the property is unsuccessfully serialized.

方法

Equals(Object)

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

(继承自 Object)
GetHashCode()

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

(继承自 Object)
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)

适用于