using System.Collections.Generic;
private Dictionary<int, byte[]> _table = new Dictionary<int, byte[]>();
public void SetBytes(int key, byte[] val)
if (_table.ContainsKey(key))
public byte[] GetBytes(int key)
public abstract class MemoryDefinition<TValue>
protected MemoryTable _memoryTable;
public abstract int Address { get; }
public abstract void SetValue(TValue val);
protected MemoryDefinition(MemoryTable memoryTable)
_memoryTable = memoryTable;
public class MPHBrightness : MemoryDefinition<byte[]>
public override int Address
public override void SetValue(byte[] val)
_memoryTable.SetBytes(Address, val);
public MPHBrightness(MemoryTable memoryTable) : base(memoryTable)
public static void Main()
var memoryTable = new MemoryTable();
var mphBrightness = new MPHBrightness(memoryTable);
mphBrightness.SetValue(new byte[] { 1, 2, 3, 4 });
foreach(var b in memoryTable.GetBytes(0x33))