A game about forced loneliness, made by TACStudios
1using System; 2using System.Collections.ObjectModel; 3 4namespace Unity.VisualScripting 5{ 6 public class GuidCollection<T> : KeyedCollection<Guid, T>, IKeyedCollection<Guid, T> where T : IIdentifiable 7 { 8 protected override Guid GetKeyForItem(T item) 9 { 10 return item.guid; 11 } 12 13 protected override void InsertItem(int index, T item) 14 { 15 Ensure.That(nameof(item)).IsNotNull(item); 16 17 base.InsertItem(index, item); 18 } 19 20 protected override void SetItem(int index, T item) 21 { 22 Ensure.That(nameof(item)).IsNotNull(item); 23 24 base.SetItem(index, item); 25 } 26 27 public new bool TryGetValue(Guid key, out T value) 28 { 29 if (Dictionary == null) 30 { 31 value = default(T); 32 return false; 33 } 34 35 return Dictionary.TryGetValue(key, out value); 36 } 37 } 38}