aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Tests.Unicorn/IndexedProperty.cs
blob: 347b91a089250903d99e04d2ad4624640738e1f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;

namespace Ryujinx.Tests.Unicorn
{
    public class IndexedProperty<TIndex, TValue>
    {
        private readonly Func<TIndex, TValue> _getFunc;
        private readonly Action<TIndex, TValue> _setAction;

        public IndexedProperty(Func<TIndex, TValue> getFunc, Action<TIndex, TValue> setAction)
        {
            _getFunc = getFunc;
            _setAction = setAction;
        }

        public TValue this[TIndex index]
        {
            get
            {
                return _getFunc(index);
            }
            set
            {
                _setAction(index, value);
            }
        }
    }
}