1.9. Query Evaluation Time
It is important to understand when the query is evaluated at run time. In Listing 1-1 nothing happens in query execution until the ObjectDumper's Write method is called. Listing 1-8 looks at the code behind this method:
Example 1-8. The Core Method of the ObjectDumper Helper Class
private void WriteObject(string prefix, object o) { if (o == null || o is ValueType || o is string) { WriteIndent(); Write(prefix); WriteValue(o); WriteLine(); } else if (o is IEnumerable) { foreach (object element in (IEnumerable)o) { if (element is IEnumerable && !(element is string)) { WriteIndent(); Write(prefix); Write("..."); WriteLine(); if (level < depth) { level++; WriteObject(prefix, element); level--; } } else { WriteObject(prefix, ... |
Get LINQ for Visual C# 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.