IndexedProperty.cs 630 B

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