Archive for May, 2009|Monthly archive page

Aging Is Like Contractions

When my son was born ten years ago, we learned in Lamaze class that you can either fight contractions or work with them. They hurt and the temptation is to fight them but that only makes it worse. Work with them and they will work with you. Surf the wave, so to speak. Of course, all this is academic to me; it was not so for my wife!

Aging is like this, perhaps. I do not want to turn 36 this year, nor 40 in 4 years. I do not look forward to my son growing up and leaving home. But I can fight the milestones, feeling that I have not done enough to prepare. Or I can surf the wave. Plan for it, expect it, work with it.

C# Quotes in string literals


Below is copied directly from him:

C# 101 – Representing a double quote in string literals

I’m sure almost every C# developer already knew this, but I thought a post might help the few that didn’t. I had always wondered how it was done and stumbled across it yesterday buried in an example in the C# Language Specification.

If you want to represent a double quote in a string literal, the escape sequence is two double quotes.

string myString = @"<xml attribute=""my attribute""/>";

I have found this useful for storing nicely formatted XML fragments in constants without resorting to 1) putting it all on one long line without string literals or 2) loading from a file or resource or 3) concatenating at run time, or 4) switching to single quotes.

private const string requestXml =
@”<?xml version=””1.0″” encoding=””utf-8″”?>
<ForceBuild xmlns=””“”>

Now I know.