LINQ With Object Dumper

Recently I encountered the Object Dumper class, which is very useful for LINQ programming. It is used on your object to dump the result to the console.

Sometimes we can't show the desired result on the console or for logging. I have used the Employee class to represent the working behavior of the Object Dumper class. Have a look at the class structure and the implementation as shown below in the screen shot:

LINQ-with-Object-Dumper.jpg


When I run the preceding code segment it shows me the error displayed below:

run-LINQ-with-Object-Dumper.jpg

Note: The reason for showing the error above is the ObjEmp object has multiple values in a collection.

To resolve this issue we have the Object Dumper class:

Object-Dumper-class.jpg   

The Object Dumper class gives you the desired result as shown here:

output-Object-Dumper-class.jpg

The sample application is attached for a reference.

Thanks


Similar Articles