I, J, and K Should Die

ijkOne of the hardest things we do as programmers is naming things.  But the easiest thing to name is counter variables and most of us do it wrong several times a day.

Of course, I’m talking about the notorious habit of naming our counter variables I, J, or K depending on how far down we’ve nested our looping.… Read the rest

Renaming Properties, Methods and Variables

B03B0065 Have you ever written some code and named something one thing only to realize that it should be named something else?

If you haven’t you haven’t been programming for very long.  Maybe you started a new job and you spent two weeks writing code using your previous employer’s naming conventions only to find out that this employer expects things to be named slightly differently.… Read the rest

CSharp VAR Misconceptions


I find it amazing that .NET 3.5 has been out for over a year and people still don’t understand the “var” keyword.

Just last week I got a comment on one of my videos asking why I used “var” so much.  Isn’t that only supposed to be used when you don’t know what the return type is going to be?… Read the rest

Easily Find Classes, Methods, and Variables

I02B0065 There is a bit of a “trick” that I use routinely in Visual Studio to help me find the definition of Classes, Methods, and Variables in my solution regardless.

This “trick” works in both CSharp and in VB.NET and, if you don’t know it already, will save you a ton of time.… Read the rest

Readonly variables in CSharp? Really?!

A lone oryx antelope. I’m sure most of you are familiar with the keyword “const,” which allows you to declare a variable and give it a value and assures that no other code will change the value.

const int v = 23;

public void Foo()
    // This causes a compile error
    v = 22;

But what about the times when you need something that kind of works like a const but needs to be initialized by the constructor?… Read the rest