Can I combine this two classes and have one fake db class?public class FakeDb : Dictionary<string, List<string>>{    public const string Table1 = Table1;    public void AddToTable(string tableName, string line)    {        if(!ContainsKey(tableName))            Add(tableName, new List<string>());        List<string> rows = GetTableData(tableName);        rows.Add(line);    }    internal List<string> GetTableData(string tableName)    {        return this[tableName];    }}public class FakeComplexDb : Dictionary<string, List<Dictionary<string,List<string>>>>{    public void AddToTable(string tableName, Dictionary<string, List<string>> line)    {        if (!ContainsKey(tableName))            Add(tableName, new List<Dictionary<string, List<string>>>());        List<Dictionary<string, List<string>>> rows = GetTableData(tableName);        rows.Add(line);    }    internal List<Dictionary<string, List<string>>> GetTableData(string tableName)    {        return this[tableName];    }}
Eliminate duplication in similar fake data access classes
c#
Why not use generics:public class FakeDb<TList> : Dictionary<string, List<TList>>{    public const string Table1 = Table1;    public void AddToTable(string tableName, TList line)    {        if (!ContainsKey(tableName))        {            Add(tableName, new List<TList>());        }        List<TList> rows = GetTableData(tableName);        rows.Add(line);    }    private List<TList> GetTableData(string tableName)    {        return this[tableName];    }}Then to use:var simpleDB = new FakeDb<string>();var complexDb = new FakeDb<Dictionary<string, List<string>>>();