A game about forced loneliness, made by TACStudios
1namespace Unity.VisualScripting
2{
3 public class VariantKeyedCollection<TBase, TImplementation, TKey> :
4 VariantCollection<TBase, TImplementation>,
5 IKeyedCollection<TKey, TBase>
6 where TImplementation : TBase
7 {
8 public VariantKeyedCollection(IKeyedCollection<TKey, TImplementation> implementation) : base(implementation)
9 {
10 this.implementation = implementation;
11 }
12
13 public TBase this[TKey key] => implementation[key];
14
15 public new IKeyedCollection<TKey, TImplementation> implementation { get; private set; }
16
17 public bool TryGetValue(TKey key, out TBase value)
18 {
19 TImplementation implementationValue;
20 var result = implementation.TryGetValue(key, out implementationValue);
21 value = implementationValue;
22 return result;
23 }
24
25 public bool Contains(TKey key)
26 {
27 return implementation.Contains(key);
28 }
29
30 public bool Remove(TKey key)
31 {
32 return implementation.Remove(key);
33 }
34
35 TBase IKeyedCollection<TKey, TBase>.this[int index] => implementation[index];
36 }
37}