Compiler 1 - Intellisense 0

string result = i++.ToString();

Looks weird doesn't it, and yet it is a perfectly valid expression. The ++ operator returns the incremented value, and the .ToString() converts it. It even compiles.

Unfortunately Intellisense doesn't handle it. Nor does it work for

(i++).ToString();

However with enough hinting (ok its a blatant cast) you can get it to work.

((int) (i++)).ToString();

But that's damn ugly, and possibly requires a runtime cast to occur. (Have to check this out)

 

Technorati Tags: ,

PS. The spelling checker in LiveWriter believes that Intellisense should be Intelligence, I beg to differ. :)

Add comment

  Country flag


  • Comment
  • Preview
Loading