IndexedProperty.cs 620 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. namespace Ryujinx.Tests.Unicorn
  3. {
  4. public class IndexedProperty<TIndex, TValue>
  5. {
  6. readonly Action<TIndex, TValue> SetAction;
  7. readonly Func<TIndex, TValue> GetFunc;
  8. public IndexedProperty(Func<TIndex, TValue> getFunc, Action<TIndex, TValue> setAction)
  9. {
  10. this.GetFunc = getFunc;
  11. this.SetAction = setAction;
  12. }
  13. public TValue this[TIndex i]
  14. {
  15. get
  16. {
  17. return GetFunc(i);
  18. }
  19. set
  20. {
  21. SetAction(i, value);
  22. }
  23. }
  24. }
  25. }