Hi, I stumbled upon this class and was wondering if XYZAdapter might be the correct name. I know how the adapter pattern works, but this solution is a bit different: Instead of implementing the DataTable interface and mapping the appropriate method calls, im creating a new DataTable object by copying the values and expose this object. Thats how it looks:
class Adapter
{
private NodeList list;
DataTable table { get { return CreateTable(); } }
Adapter(NodeList nl)
{
list = nl;
}
private DataTable CreateTable()
{
// Fetch Data in NodeList, create a Table and return it
// needs to be splitted in smaller methods ;D
}
}
Usually im doing it this way, but the DataTable interface is enormus:
class Adapter : DataTable
{
private NodeList list;
DataTable table { get { return CreateTable(); } }
Adapter(NodeList nl)
{
list = nl;
}
// Here are all the DataTable methods mapped to NodeList
}
Thanks in advance!