Name + "
Price : " + ItemswithLowPrice.Price);
The variable, topicecreamsWithLesserPrice will contain only those items with
price less than or equal to 10. Once the item with price greater than ten is found, all
the remaining items will be ignored, including the first one which does not satisfy
the condition.
Element Operators
These operators return a specific or a single element from a sequence.
DefaultIfEmpty
This operator is useful for replacing an empty sequence with a default value. When
an object returned by DefaultIfEmpty is enumerated, it enumerates the source
sequence object and retrieves its elements. If the source is empty, a single element
d with a default value is returned. The default value for reference and nullable types is
null. An ArgumentNullException is thrown if the source is null.
public static IEnumerable
DefaultIfEmpty
(
IEnumerable source
)
public static IEnumerable DefaultIfEmpty
(
IEnumerable source,
TSource defaultValue
)
Standard Query Operators
[ 210 ]
In the following example, we use the defaultItem argument.
Pages:
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313