Skip to content

Commit 60dd7f6

Browse files
author
Adam Smith-Platts
committed
[#675] Corrected order of execution when assigning values to ValueX, from object collection, and correctly storing the state of HasValueX
1 parent 3a7c334 commit 60dd7f6

6 files changed

+33
-33
lines changed

Source/Common/Values{T1,T2,T3,T4,T5,T6,T7}.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,21 @@ public Values(IEnumerable<object?> items)
245245
}
246246
}
247247

248-
this.HasValue1 = items1?.Count > 0;
249-
this.HasValue2 = items2?.Count > 0;
250-
this.HasValue3 = items3?.Count > 0;
251-
this.HasValue4 = items4?.Count > 0;
252-
this.HasValue5 = items5?.Count > 0;
253-
this.HasValue6 = items6?.Count > 0;
254-
this.HasValue7 = items7?.Count > 0;
255-
256248
this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
257249
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
258250
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
259251
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
260252
this.Value5 = items5 == null ? default : (OneOrMany<T5>)items5;
261253
this.Value6 = items6 == null ? default : (OneOrMany<T6>)items6;
262254
this.Value7 = items7 == null ? default : (OneOrMany<T7>)items7;
255+
256+
this.HasValue1 = this.Value1.Count > 0;
257+
this.HasValue2 = this.Value2.Count > 0;
258+
this.HasValue3 = this.Value3.Count > 0;
259+
this.HasValue4 = this.Value4.Count > 0;
260+
this.HasValue5 = this.Value5.Count > 0;
261+
this.HasValue6 = this.Value6.Count > 0;
262+
this.HasValue7 = this.Value7.Count > 0;
263263
}
264264

265265
/// <summary>

Source/Common/Values{T1,T2,T3,T4,T5,T6}.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,19 @@ public Values(IEnumerable<object?> items)
204204
}
205205
}
206206

207-
this.HasValue1 = items1?.Count > 0;
208-
this.HasValue2 = items2?.Count > 0;
209-
this.HasValue3 = items3?.Count > 0;
210-
this.HasValue4 = items4?.Count > 0;
211-
this.HasValue5 = items5?.Count > 0;
212-
this.HasValue6 = items6?.Count > 0;
213-
214207
this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
215208
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
216209
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
217210
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
218211
this.Value5 = items5 == null ? default : (OneOrMany<T5>)items5;
219212
this.Value6 = items6 == null ? default : (OneOrMany<T6>)items6;
213+
214+
this.HasValue1 = this.Value1.Count > 0;
215+
this.HasValue2 = this.Value2.Count > 0;
216+
this.HasValue3 = this.Value3.Count > 0;
217+
this.HasValue4 = this.Value4.Count > 0;
218+
this.HasValue5 = this.Value5.Count > 0;
219+
this.HasValue6 = this.Value6.Count > 0;
220220
}
221221

222222
/// <summary>

Source/Common/Values{T1,T2,T3,T4,T5}.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,17 @@ public Values(IEnumerable<object?> items)
167167
}
168168
}
169169

170-
this.HasValue1 = items1?.Count > 0;
171-
this.HasValue2 = items2?.Count > 0;
172-
this.HasValue3 = items3?.Count > 0;
173-
this.HasValue4 = items4?.Count > 0;
174-
this.HasValue5 = items5?.Count > 0;
175-
176170
this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
177171
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
178172
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
179173
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
180174
this.Value5 = items5 == null ? default : (OneOrMany<T5>)items5;
175+
176+
this.HasValue1 = this.Value1.Count > 0;
177+
this.HasValue2 = this.Value2.Count > 0;
178+
this.HasValue3 = this.Value3.Count > 0;
179+
this.HasValue4 = this.Value4.Count > 0;
180+
this.HasValue5 = this.Value5.Count > 0;
181181
}
182182

183183
/// <summary>

Source/Common/Values{T1,T2,T3,T4}.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ public Values(IEnumerable<object?> items)
134134
}
135135
}
136136

137-
this.HasValue1 = items1?.Count > 0;
138-
this.HasValue2 = items2?.Count > 0;
139-
this.HasValue3 = items3?.Count > 0;
140-
this.HasValue4 = items4?.Count > 0;
141-
142137
this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
143138
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
144139
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
145140
this.Value4 = items4 == null ? default : (OneOrMany<T4>)items4;
141+
142+
this.HasValue1 = this.Value1.Count > 0;
143+
this.HasValue2 = this.Value2.Count > 0;
144+
this.HasValue3 = this.Value3.Count > 0;
145+
this.HasValue4 = this.Value4.Count > 0;
146146
}
147147

148148
/// <summary>

Source/Common/Values{T1,T2,T3}.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ public Values(IEnumerable<object> items)
105105
}
106106
}
107107

108-
this.HasValue1 = items1?.Count > 0;
109-
this.HasValue2 = items2?.Count > 0;
110-
this.HasValue3 = items3?.Count > 0;
111-
112108
this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
113109
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
114110
this.Value3 = items3 == null ? default : (OneOrMany<T3>)items3;
111+
112+
this.HasValue1 = this.Value1.Count > 0;
113+
this.HasValue2 = this.Value2.Count > 0;
114+
this.HasValue3 = this.Value3.Count > 0;
115115
}
116116

117117
/// <summary>

Source/Common/Values{T1,T2}.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ public Values(IEnumerable<object?> items)
8080
}
8181
}
8282

83-
this.HasValue1 = items1?.Count > 0;
84-
this.HasValue2 = items2?.Count > 0;
85-
8683
this.Value1 = items1 == null ? default : (OneOrMany<T1>)items1;
8784
this.Value2 = items2 == null ? default : (OneOrMany<T2>)items2;
85+
86+
this.HasValue1 = this.Value1.Count > 0;
87+
this.HasValue2 = this.Value2.Count > 0;
8888
}
8989

9090
/// <summary>

0 commit comments

Comments
 (0)