Created
July 27, 2019 08:58
-
-
Save Y-Koji/3660a8c15f29a996de1eaeb401ac8af3 to your computer and use it in GitHub Desktop.
C# Data Objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
/// <summary>データ表現用共通オブジェクト (Dictinaryプロキシクラス)</summary> | |
/// <typeparam name="TKey">The type of keys in the dictionary.</typeparam> | |
/// <typeparam name="TValue">The type of values in the dictionary.</typeparam> | |
public class DictionaryProxy<TKey, TValue> : IDictionary<TKey, TValue> | |
{ | |
private IDictionary<TKey, TValue> dictObj = new Dictionary<TKey, TValue>(); | |
public virtual TValue this[TKey key] { get => dictObj[key]; set => dictObj[key] = value; } | |
public virtual ICollection<TKey> Keys => dictObj.Keys; | |
public virtual ICollection<TValue> Values => dictObj.Values; | |
public virtual int Count => dictObj.Count; | |
public virtual bool IsReadOnly => dictObj.IsReadOnly; | |
public virtual void Add(TKey key, TValue value) | |
=> dictObj.Add(key, value); | |
public virtual void Add(KeyValuePair<TKey, TValue> item) | |
=> dictObj.Add(item); | |
public virtual void Clear() | |
=> dictObj.Clear(); | |
public virtual bool Contains(KeyValuePair<TKey, TValue> item) | |
=> dictObj.Contains(item); | |
public virtual bool ContainsKey(TKey key) | |
=> dictObj.ContainsKey(key); | |
public virtual void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex) | |
=> dictObj.CopyTo(array, arrayIndex); | |
public virtual IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() | |
=> dictObj.GetEnumerator(); | |
public virtual bool Remove(TKey key) | |
=> dictObj.Remove(key); | |
public virtual bool Remove(KeyValuePair<TKey, TValue> item) | |
=> dictObj.Remove(item); | |
public virtual bool TryGetValue(TKey key, out TValue value) | |
=> dictObj.TryGetValue(key, out value); | |
IEnumerator IEnumerable.GetEnumerator() | |
=> dictObj.GetEnumerator(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment