1. Measuring Elapsed Time in C# Methods

    When determining why some damned thing in my .NET programs is taking so damned long, it is useful to be able to look at the elapsed time for various sections of code. The straightforward way to do this is to create an instance of System.Diagnostics.Stopwatch, start it, do …

    » Read more

  2. Creating .NET Remoting IPC Channels

    Yet another C# code snippet. I'm developing a service and an accompanying UI that always run on the same physical box, and it was suggested that I implement the communication between them using .NET Remoting and the IPC channel type, which is a supposedly-easy way to get processes on the …

    » Read more

  3. Pretty-formatting XML in C#

    I had a need to convert an XML string to a nice, indented format. It was a little more complicated than I expected, so I'm posting this snippet here where I can find it again when I need it.

    using System;
    using System.Text;
    using System.Xml;
    using System.Xml …

    » Read more

© 2003-2023 Kristopher Johnson