SettingsContext SettingsContext SettingsContext SettingsContext Class

定义

提供程序在保持设置时可使用的上下文信息。Provides contextual information that the provider can use when persisting settings.

public ref class SettingsContext : System::Collections::Hashtable
[System.Serializable]
public class SettingsContext : System.Collections.Hashtable
type SettingsContext = class
    inherit Hashtable
Public Class SettingsContext
Inherits Hashtable
继承
SettingsContextSettingsContextSettingsContextSettingsContext
属性

注解

SettingsContext类是应用程序用来向设置提供程序提供上下文信息的基类。The SettingsContext class is the base class used by applications to provide contextual information to the settings provider. 尽管类不是抽象类, 应用程序可以选择创建一个从SettingsContext类继承的专用类, 并向特定类型的提供程序提供附加信息。Although the class is not abstract, an application can choose to create a specialized class that inherits from SettingsContext class and provides additional information to specific types of providers. 然后, 提供程序可以在编写属性时检查上下文设置。The provider can then examine contextual settings when writing properties.

SettingsContext类的主要目的是提供SettingsBase使用类和相关基础结构的功能。The primary purpose of the SettingsContext class is to provide features that use the SettingsBase class and related infrastructure. 类提供有关SettingsBase实例存储的属性数据的附加功能特定的上下文信息。 SettingsContextThe SettingsContext class provides additional feature-specific contextual information about the property data being stored by the SettingsBase instance. 因此, 在SettingsContext类中存储附加信息 (而不是从其派生 (或从其他 Settings * 类) 来支持其他功能特定的上下文信息非常简单。Therefore, it is very simple to store additional information in a SettingsContext class without deriving from it (or from other Settings* classes) in order to support additional feature-specific context information.

例如, ASP.NET 使用SettingsContext类传递与SettingsBase实例所管理的数据关联的用户名, 以及指示是否将用户视为已通过身份验证的属性。For example, ASP.NET uses the SettingsContext class to pass along the username associated with the data managed by a SettingsBase instance, as well as a property indicating whether the user is considered authenticated. 这样, ASP.NET 将使用SettingsContext类来确定经过身份验证的与匿名配置文件数据。In this way, ASP.NET uses the SettingsContext class to identify authenticated versus anonymous Profile data.

构造函数

SettingsContext() SettingsContext() SettingsContext() SettingsContext()

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

SettingsContext(SerializationInfo, StreamingContext) SettingsContext(SerializationInfo, StreamingContext) SettingsContext(SerializationInfo, StreamingContext) SettingsContext(SerializationInfo, StreamingContext)

方法

Add(Object, Object) Add(Object, Object) Add(Object, Object) Add(Object, Object)

将带有指定键和值的元素添加到 Hashtable 中。Adds an element with the specified key and value into the Hashtable.

(Inherited from Hashtable)
Clear() Clear() Clear() Clear()

Hashtable 中移除所有元素。Removes all elements from the Hashtable.

(Inherited from Hashtable)
Clone() Clone() Clone() Clone()

创建 Hashtable 的浅表副本。Creates a shallow copy of the Hashtable.

(Inherited from Hashtable)
Contains(Object) Contains(Object) Contains(Object) Contains(Object)

确定 Hashtable 是否包含特定键。Determines whether the Hashtable contains a specific key.

(Inherited from Hashtable)
ContainsKey(Object) ContainsKey(Object) ContainsKey(Object) ContainsKey(Object)

确定 Hashtable 是否包含特定键。Determines whether the Hashtable contains a specific key.

(Inherited from Hashtable)
ContainsValue(Object) ContainsValue(Object) ContainsValue(Object) ContainsValue(Object)

确定 Hashtable 是否包含特定值。Determines whether the Hashtable contains a specific value.

(Inherited from Hashtable)
CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Hashtable 元素复制到一维 Array 实例中的指定索引位置。Copies the Hashtable elements to a one-dimensional Array instance at the specified index.

(Inherited from Hashtable)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回循环访问 IDictionaryEnumeratorHashtableReturns an IDictionaryEnumerator that iterates through the Hashtable.

(Inherited from Hashtable)
GetHash(Object) GetHash(Object) GetHash(Object) GetHash(Object)

返回指定键的哈希代码。Returns the hash code for the specified key.

(Inherited from Hashtable)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

实现 ISerializable 接口,并返回序列化 Hashtable 所需的数据。Implements the ISerializable interface and returns the data needed to serialize the Hashtable.

(Inherited from Hashtable)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
KeyEquals(Object, Object) KeyEquals(Object, Object) KeyEquals(Object, Object) KeyEquals(Object, Object)

将特定 ObjectHashtable 中的特定键进行比较。Compares a specific Object with a specific key in the Hashtable.

(Inherited from Hashtable)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object)

实现 ISerializable 接口,并在完成反序列化之后引发反序列化事件。Implements the ISerializable interface and raises the deserialization event when the deserialization is complete.

(Inherited from Hashtable)
Remove(Object) Remove(Object) Remove(Object) Remove(Object)

Hashtable 中移除包含指定键的元素。Removes the element with the specified key from the Hashtable.

(Inherited from Hashtable)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

属性

comparer comparer comparer comparer

获取或设置要用于 IComparerHashtableGets or sets the IComparer to use for the Hashtable.

(Inherited from Hashtable)
Count Count Count Count

获取包含在 Hashtable 中的键/值对的数目。Gets the number of key/value pairs contained in the Hashtable.

(Inherited from Hashtable)
EqualityComparer EqualityComparer EqualityComparer EqualityComparer

获取要用于 IEqualityComparerHashtableGets the IEqualityComparer to use for the Hashtable.

(Inherited from Hashtable)
hcp hcp hcp hcp

获取或设置可分配哈希代码的对象。Gets or sets the object that can dispense hash codes.

(Inherited from Hashtable)
IsFixedSize IsFixedSize IsFixedSize IsFixedSize

获取一个值,该值指示 Hashtable 是否具有固定大小。Gets a value indicating whether the Hashtable has a fixed size.

(Inherited from Hashtable)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示 Hashtable 是否为只读。Gets a value indicating whether the Hashtable is read-only.

(Inherited from Hashtable)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示是否同步对 Hashtable 的访问(线程安全)。Gets a value indicating whether access to the Hashtable is synchronized (thread safe).

(Inherited from Hashtable)
Item[Object] Item[Object] Item[Object] Item[Object]

获取或设置与指定的键关联的值。Gets or sets the value associated with the specified key.

(Inherited from Hashtable)
Keys Keys Keys Keys

获取包含 ICollection 中的键的 HashtableGets an ICollection containing the keys in the Hashtable.

(Inherited from Hashtable)
SyncRoot SyncRoot SyncRoot SyncRoot

获取可用于同步对 Hashtable 的访问的对象。Gets an object that can be used to synchronize access to the Hashtable.

(Inherited from Hashtable)
Values Values Values Values

获取一个 ICollection,它包含 Hashtable 中的值。Gets an ICollection containing the values in the Hashtable.

(Inherited from Hashtable)

显式界面实现

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

(Inherited from Hashtable)

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅