C# Brain dump

By John Bowen, 20 May, 2008

In a moment of severe mental weakness, I couldn't remember how to assign an integer's value as a text (string) value (yes, really). I found it funny enough to write up here. Here's what I tried (this actually works!):

this.lblItemID.Text = ((int)0).ToString();

After I wrote it, I just stared at it for a few seconds, before realizing the better (and easier, and obvious) way:

this.lblItemID.Text = "0';

I don't even know where that first sample came from...I was just typing along and suddenly, there it was. Sheesh.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.