mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-15 09:35:27 +00:00
29 lines
620 B
C#
29 lines
620 B
C#
|
using System;
|
||
|
|
||
|
namespace Ryujinx.Tests.Unicorn
|
||
|
{
|
||
|
public class IndexedProperty<TIndex, TValue>
|
||
|
{
|
||
|
readonly Action<TIndex, TValue> SetAction;
|
||
|
readonly Func<TIndex, TValue> GetFunc;
|
||
|
|
||
|
public IndexedProperty(Func<TIndex, TValue> getFunc, Action<TIndex, TValue> setAction)
|
||
|
{
|
||
|
this.GetFunc = getFunc;
|
||
|
this.SetAction = setAction;
|
||
|
}
|
||
|
|
||
|
public TValue this[TIndex i]
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return GetFunc(i);
|
||
|
}
|
||
|
set
|
||
|
{
|
||
|
SetAction(i, value);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|