DCSIMG
.Net Tip: Console.Out - IronShay

.Net Tip: Console.Out

Shabat Shalom everyone!

The Problem
Sometimes you want your output to get written to the console and all you have is a method that receives a stream to output to. For example, DataSet.WriteXml gets different types of streams or a file path to write to...

The Solution
If you want to output the result to the screen, use Console.Out as your stream:

DataSet d = GetDataSetFromSomewhere();
d.WriteXml(Console.Out);

That's it!

All the best,
Shay.

Published Saturday, November 22, 2008 5:40 AM by shayf

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: