Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

C# 4.0! Visual Studio 2010 CTP!

Can't believe I missed this release... There's a lot of exciting new features upcoming in the .NET front. My personal favorites:

  • IDynamicObject and C# 4.0: C# can now has native/syntactic support for dynamic objects that may come from JavaScript, IronRuby, IronPython, COM, etc. Pretty awesome!
  • Optional Parameters: Remember the good ol' days of C++ where you could define optional parameters with default values set for you? Yeah, they're back. I imagine that some changes had to be made to the type system/reflector; I'm curious as to how this works under the hood.

Click here to download the Visual Studio 2010 and .NET Framework 4.0 CTP.

And here's some documentation and code samples for the new features in C# 4.0.

Note: Ugh, the CTP is a Virtual PC instance. Guess I'll have to wait till they have a installable version, or maybe just convert the instance to HyperV...

Visual Studio's "Watch" Window

One of the cool and not-so-well-known features of the Visual Studio Watch window is that it not only lets you read and modify values, but also evaluate arbitrary expressions on the system. In one of my current projects, I am doing a significant amount of rendering to a Bitmap prior to blitting it to the screen. If there's a bug in the rendering, it can be quite difficult to track down what the issue is with just a Watch window. It would be a lot more helpful to actually see the contents of the Bitmap as you are rendering it. And you can, by typing in the expression to save the bitmap out, while execution is halted! For example:

Watch

After typing that in, you can just go to the directory where the image was saved and inspect it. Very useful trick. If you have any of your own, please share!