Table of Contents

SyncDictionaryList<TKey, TValue> 类

命名空间
ClassIsland.Core.ComponentModels
程序集
ClassIsland.Core.dll

可同步字典与列表的数据类型,用于将字典绑定到前端数据上。

public class SyncDictionaryList<TKey, TValue> : INotifyPropertyChanged where TKey : notnull

类型参数

TKey
TValue
继承
SyncDictionaryList<TKey, TValue>
实现
继承成员

构造函数

SyncDictionaryList(IDictionary<TKey, TValue>, Func<TKey>, KeyValuePair<TKey, TValue>?)

初始化一个 SyncDictionaryList<TKey, TValue> 对象。

public SyncDictionaryList(IDictionary<TKey, TValue> dictionary, Func<TKey> newKey, KeyValuePair<TKey, TValue>? defaultValue = null)

参数

dictionary IDictionary<TKey, TValue>
newKey Func<TKey>
defaultValue KeyValuePair<TKey, TValue>?

属性

DefaultValue

要向列表中添加的默认值。此默认值不会同步回字典。

public KeyValuePair<TKey, TValue>? DefaultValue { get; }

属性值

KeyValuePair<TKey, TValue>?

List

公开的用于进行绑定的列表。

public ObservableCollection<KeyValuePair<TKey, TValue>> List { get; }

属性值

ObservableCollection<KeyValuePair<TKey, TValue>>

方法

OnPropertyChanged(string?)

protected virtual void OnPropertyChanged(string? propertyName = null)

参数

propertyName string

SetField<T>(ref T, T, string?)

protected bool SetField<T>(ref T field, T value, string? propertyName = null)

参数

field T
value T
propertyName string

返回

bool

类型参数

T

事件

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler? PropertyChanged

事件类型

PropertyChangedEventHandler