August 2008
Intermediate to advanced
197 pages
3h 23m
English
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:
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, ... |
Read now
Unlock full access