Since the minimum unit constituting the data unit, after the row and column headers class, it has become very easy to write
Table is the same, the set of all lines, namely table, so we are also very easy to write the table class
as follows:
Code
public class MDataTable : List<MDataRow>
{
private string _TableName =string.Empty;
/**//// <summary>
/// 表名
/// </summary>
public string TableName
{
get
{
return _TableName;
}
set
{
_TableName = value;
}
}
public MDataTable()
{
_TableName = "Default";
}
public MDataTable(string tableName)
{
_TableName = tableName;
}
}
public class MDataTable : List<MDataRow>
{
private string _TableName =string.Empty;
/**//// <summary>
/// 表名
/// </summary>
public string TableName
{
get
{
return _TableName;
}
set
{
_TableName = value;
}
}
public MDataTable()
{
_TableName = "Default";
}
public MDataTable(string tableName)
{
_TableName = tableName;
}
}
At this table is the basic building good, only a default table name property
We add property to access the column header for it
as follows:
Code
private MDataColumn _Columns;
public MDataColumn Columns
{
get
{
if (this.Count > 0)
{
return this[0].Columns;
}
if (_Columns == null)
{
_Columns = new MDataColumn();
}
return _Columns;
}
}
private MDataColumn _Columns;
public MDataColumn Columns
{
get
{
if (this.Count > 0)
{
return this[0].Columns;
}
if (_Columns == null)
{
_Columns = new MDataColumn();
}
return _Columns;
}
}
At this point, the table also completed the basic building
The next section, we will realize that we make with our custom MTable common user interaction controls
Reproduced in: https: //my.oschina.net/secyaher/blog/274386