aboutsummaryrefslogblamecommitdiff
path: root/Ryujinx.Tests.Unicorn/IndexedProperty.cs
blob: 65d445fc0338a4f99c6a8e11a69b692459074860 (plain) (tree)
1
2
3
4
5
6
7
8




                                                
                                                  

                                                                                              
                                   
         
                                        

               
                                       

               
                                         


             
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);
            }
        }
    }
}