elberon5.com

VS.NET 2005 Trick

Posted by elberon5 Fri, 20 Jul 2007 14:33:00 GMT

Ok. Yet another cool trick that Visual Studio 2005 can do. Automatically make all the cases in a switch using an enumerator.

E.g.
public enum DMS
{
  Degrees,
  Minutes,
  Seconds,
  Direction
}

Ok. Now the cool part. Hit Ctrl-K, Ctrl-X, then select switch and type dms, enter. and BAM! you have this automatically written for you.

switch (dms)
 {
  case DMS.Degrees:
    break;
  case DMS.Minutes:
    break;
  case DMS.Seconds:
    break;
  case DMS.Direction:
    break;
  default:
    break;
 }

Enjoy!

(leave url/email »)