Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EnumerableRowCollection.cs
Go to the documentation of this file.
3using System.Linq;
4
5namespace System.Data;
6
7public abstract class EnumerableRowCollection : IEnumerable
8{
9 internal abstract Type ElementType { get; }
10
11 internal abstract DataTable? Table { get; }
12
14 {
15 }
16
18 {
19 return null;
20 }
21}
23{
24 private readonly DataTable _table;
25
27
29
31
32 private readonly Func<TRow, TRow> _selector;
33
34 internal override Type ElementType => typeof(TRow);
35
37
38 internal override DataTable? Table => _table;
39
50
58
60 {
63 if (source != null)
64 {
65 if (source._selector == null)
66 {
67 _table = source._table;
68 }
69 _listOfPredicates = new List<Func<TRow, bool>>(source._listOfPredicates);
70 _sortExpression = source._sortExpression.Clone();
71 }
72 else
73 {
76 }
77 }
78
83
88
90 {
91 if (_table == null || !typeof(DataRow).IsAssignableFrom(typeof(TRow)))
92 {
94 }
97 if (_selector != null && 0 < _listOfPredicates.Count)
98 {
100 {
101 if (row != (object)_selector((TRow)(object)row))
102 {
104 }
106 {
107 if (!listOfPredicate((TRow)(object)row))
108 {
109 return false;
110 }
111 }
112 return true;
113 };
114 }
115 else if (_selector != null)
116 {
118 {
119 if (row != (object)_selector((TRow)(object)row))
120 {
122 }
123 return true;
124 };
125 }
126 else if (0 < _listOfPredicates.Count)
127 {
129 {
131 {
132 if (!listOfPredicate2((TRow)(object)row))
133 {
134 return false;
135 }
136 }
137 return true;
138 };
139 }
140 if (finalPredicate != null && 0 < _sortExpression.Count)
141 {
143 }
144 if (finalPredicate != null)
145 {
146 return new LinqDataView(_table, (DataRow row) => finalPredicate(row), null, null, _sortExpression.CloneCast<DataRow>());
147 }
148 if (0 < _sortExpression.Count)
149 {
151 }
152 return new LinqDataView(_table, _sortExpression.CloneCast<DataRow>());
153 }
154
156 {
158 }
159
164
166 {
167 DataSetUtil.CheckArgumentNull(keySelector, "keySelector");
168 DataSetUtil.CheckArgumentNull(comparer, "comparer");
169 _sortExpression.Add((TRow input) => keySelector(input), (object val1, object val2) => ((!isDescending) ? 1 : (-1)) * comparer.Compare((TKey)val1, (TKey)val2), isOrderBy);
170 }
171}
static NotSupportedException NotSupported(string message)
DataRowCollection Rows
Definition DataTable.cs:701
EnumerableRowCollection(EnumerableRowCollection< TRow > source, IEnumerable< TRow > enumerableRows, Func< TRow, TRow > selector)
void AddPredicate(Func< TRow, bool > pred)
readonly IEnumerable< TRow > _enumerableRows
readonly SortExpressionBuilder< TRow > _sortExpression
EnumerableRowCollection(IEnumerable< TRow > enumerableRows, bool isDataViewable, DataTable table)
readonly List< Func< TRow, bool > > _listOfPredicates
void AddSortExpression< TKey >(Func< TRow, TKey > keySelector, bool isDescending, bool isOrderBy)
void Add(Func< T, object > keySelector, Comparison< object > compare, bool isOrderBy)
int Compare(List< object > a, List< object > b)
SortExpressionBuilder< T > Clone()
static string ToLDVUnsupported
Definition SR.cs:924
Definition SR.cs:7
new IEnumerator< T > GetEnumerator()