aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Tests.Unicorn/IndexedProperty.cs
blob: 65d445fc0338a4f99c6a8e11a69b692459074860 (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 Func<TIndex, TValue>   _getFunc;
        private 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);
            }
        }
    }
}