개정판 1c7f408a
mainWindow를 RadWindow로 변경
Change-Id: I0ac468f572b53cd39e832aed20e7d350b5c03d42
KCOM/Extensions/CollectionExtenstions.cs | ||
---|---|---|
171 | 171 |
|
172 | 172 |
/// <summary> |
173 | 173 |
/// Update all elements of IEnumerable by the update function (only works with reference types) |
174 |
/// where the where function returns true |
|
175 | 174 |
/// </summary> |
176 | 175 |
/// <param name="enumerable">The enumerable where you want to change stuff</param> |
177 |
/// <param name="update">The way you want to change the stuff</param> |
|
178 |
/// <param name="where">The function to check where updates should be made</param> |
|
176 |
/// <param name="Find">T와 동일한 첫번째 Item을 찾는다. 없으면 null을 반환</param> |
|
179 | 177 |
/// <returns> |
180 | 178 |
/// The same enumerable you passed in |
181 | 179 |
/// </returns> |
182 |
public static IEnumerable<T> UpdateWhere<T>(this IEnumerable<T> enumerable, |
|
180 |
public static T Find<T>(this IEnumerable<T> enumerable, Func<T, bool> where) where T : class |
|
181 |
{ |
|
182 |
T result = null; |
|
183 |
|
|
184 |
foreach (var item in enumerable) |
|
185 |
{ |
|
186 |
if (where(item)) |
|
187 |
{ |
|
188 |
result = item; |
|
189 |
} |
|
190 |
} |
|
191 |
|
|
192 |
return result; |
|
193 |
} |
|
194 |
|
|
195 |
/// <summary> |
|
196 |
/// Update all elements of IEnumerable by the update function (only works with reference types) |
|
197 |
/// where the where function returns true |
|
198 |
/// </summary> |
|
199 |
/// <param name="enumerable">The enumerable where you want to change stuff</param> |
|
200 |
/// <param name="update">The way you want to change the stuff</param> |
|
201 |
/// <param name="where">The function to check where updates should be made</param> |
|
202 |
/// <returns> |
|
203 |
/// The same enumerable you passed in |
|
204 |
/// </returns> |
|
205 |
public static IEnumerable<T> UpdateWhere<T>(this IEnumerable<T> enumerable, |
|
183 | 206 |
Action<T> update, Func<T, bool> where) where T : class |
184 | 207 |
{ |
185 | 208 |
ArgumentCheck.IsNullorWhiteSpace(enumerable, "enumerable"); |
내보내기 Unified diff