@@ -12,6 +12,11 @@ public class UXFDataTable
12
12
public string [ ] Headers { get { return dict . Keys . ToArray ( ) ; } }
13
13
private Dictionary < string , List < object > > dict ;
14
14
15
+ /// <summary>
16
+ /// Construct a table with given estimated row capacity and column names.
17
+ /// </summary>
18
+ /// <param name="capacity"></param>
19
+ /// <param name="columnNames"></param>
15
20
public UXFDataTable ( int capacity , params string [ ] columnNames )
16
21
{
17
22
dict = new Dictionary < string , List < object > > ( ) ;
@@ -21,6 +26,10 @@ public UXFDataTable(int capacity, params string[] columnNames)
21
26
}
22
27
}
23
28
29
+ /// <summary>
30
+ /// Construct a table with given column names.
31
+ /// </summary>
32
+ /// <param name="columnNames"></param>
24
33
public UXFDataTable ( params string [ ] columnNames )
25
34
{
26
35
dict = new Dictionary < string , List < object > > ( ) ;
@@ -30,6 +39,10 @@ public UXFDataTable(params string[] columnNames)
30
39
}
31
40
}
32
41
42
+ /// <summary>
43
+ /// Add a complete row to the table
44
+ /// </summary>
45
+ /// <param name="newRow"></param>
33
46
public void AddCompleteRow ( UXFDataRow newRow )
34
47
{
35
48
bool sameKeys = ( dict
@@ -59,6 +72,10 @@ public void AddCompleteRow(UXFDataRow newRow)
59
72
}
60
73
}
61
74
75
+ /// <summary>
76
+ /// Count and return the number of rows.
77
+ /// </summary>
78
+ /// <returns></returns>
62
79
public int CountRows ( )
63
80
{
64
81
string [ ] keyArray = dict . Keys . ToArray ( ) ;
@@ -67,6 +84,10 @@ public int CountRows()
67
84
return dict [ keyArray [ 0 ] ] . Count ( ) ;
68
85
}
69
86
87
+ /// <summary>
88
+ /// Return the table as a set of strings, each string a line a row with comma-seperated values.
89
+ /// </summary>
90
+ /// <returns></returns>
70
91
public string [ ] GetCSVLines ( )
71
92
{
72
93
string [ ] headers = Headers ;
@@ -83,6 +104,10 @@ public string[] GetCSVLines()
83
104
return lines ;
84
105
}
85
106
107
+ /// <summary>
108
+ /// Return the table as a dictionary of lists.
109
+ /// </summary>
110
+ /// <returns></returns>
86
111
public Dictionary < string , List < object > > GetAsDictOfList ( )
87
112
{
88
113
Dictionary < string , List < object > > dictCopy = new Dictionary < string , List < object > > ( ) ;
@@ -93,6 +118,10 @@ public Dictionary<string, List<object>> GetAsDictOfList()
93
118
return dictCopy ;
94
119
}
95
120
121
+ /// <summary>
122
+ /// Return the table as a list of dictionaries.
123
+ /// </summary>
124
+ /// <returns></returns>
96
125
public List < Dictionary < string , object > > GetAsListOfDict ( )
97
126
{
98
127
int numRows = CountRows ( ) ;
0 commit comments