
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
478
|
Chapter 8: Diagnostics
Waiting to read from the stream until the application has finished ensures that there
will be no deadlock issues. If the stream is accessed synchronously before this time,
then the possibility exists for the parent to block the child. At a minimum, the child
will wait until the parent has finished reading from the stream before it continues
writing to it. So by postponing the read until the end, you allow the child to have less
performance degradation at the cost of some additional time at the end.
See Also
See Recipe 12.21; see the “ProcessStartInfo.RedirectStandardOutput Property” and
“ProcessStartInfo.UseShellExecute Property” topics in the MSDN documentation.
8.15 Creating Custom Debugging Displays
for Your Classes
Problem
You have a set of classes that are used in your application. You would like to see at a
glance in the debugger what a particular instance of the class holds. The default
debugger display doesn’t show any useful information for your class today.
Solution
Add a DebuggerDisplayAttribute to your class to make the debugger show you
something you consider useful about your class. For example, if you had a
Citizen
class that held the honorific and name information, you could add a
DebuggerDisplayAttribute like this one:
[DebuggerDisplay("Citizen Full ...