simple TcpClient echo client/server example

I was trying to help a beginner dev that (like many early on) wanted to tackle an irc bot as their first project.  They had apparently googled for C# irc and came across this code.  Now, having spent a couple of my college years running my own irc server on EFNet, I’m not really inclined to…

4

Pretty-printing valid xml snippet

It’s proven useful in a couple of places, and it’s pretty small and self-documenting.  I had written this mainly to look at my VS settings file in a nicer way since it saves with a minimum of whitespace.   private static string ToPrettyXml(string xml) {     XmlDocument doc = new XmlDocument();     try     {…

1

IEnumerable<T> and interleaving of I/O with CPU

Not all problems lend themselves to this, but as a general suggestion, if you’re handling T[] or {I,}List<T> or ArrayList or the like of items (especially ones coming from I/O sources – files, network, etc.) with a single pass, you should consider (as with all perf, measure, measure, measure!) going the piecemeal route with IEnumerable<T>…

3