Tuesday, November 23, 2010

find all listening ports - back to basics

netstat -an |find /i "listening"


open a port from cmd
netsh> add portopening TCP 9353 "xyz"

Monday, November 8, 2010

Eliminate if else statements for disabling and enabling controls

if (count > 0)
{
this.control.Enabled = false;
}
else
{
this.control.Enabled = true;
}



// this is 1 line compared to what we have above.
this.control.Enabled = (count <= 0);

Tuesday, November 2, 2010

DateTime vs DateTimeOffset

if (you are developing applications with globalization in mind)
{
use DateTimeOffset
}
else
{
use dateTime
}