Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Christopher Bennage

Our WPF book is now available!

October 2007 - Posts

  • 42m is not a constant

    Here's a little CLR tidbit I picked up today while writing a [RowTest] with MbUnit.

    If you want to specify a decimal value in C#, you add the suffix m or M.  You can read all about it here.  This means you might have something in your code  like this:

    decimal myBigMoney = 19.95m;

    Well, it turns out that 19.95m is not a constant value, it's actually shorthand that the compiler translates to

    decimal myBigMoney = new decimal(19.95);

    and "decimal" is an alias of the struct System.Decimal. This means that you can't pass the value 19.95m as an argument into an attribute, like this:

    [RowTest(19.95m)]

    (because attribute arguments must be constants!) Luckily, MbUnit 2.4 will implicitly convert your doubles into decimals for you...

    Where credit is due: I discovered this here.

  • REMIX DAY 1

    Despite the fact that I got off to a miserable start (walking along the Charles, rain soaked and a bit lost) today was a blast.

    I got to hear Rockford Lhotka (of CSLA fame) along with Anthony Handley describe their recent experiences with WPF. This was cool because they've been working on the same kind of project as Rob and I. It was very affirming. I mean, it's kinda of like meeting a rock star and realizing that he's practicing the same guitar riffs you are. :-)

    We also attended a great session on casual game development in Silverlight by Andy Beaulieu. Andy demonstrated how to build a simple game using Visual Studio and Blend. I think that's pretty impressive for one session. I recommend checking out the examples on his site if you are interesting in Silverlight, even if that interest is unrelated to game development.

    We also caught up with fellow Floridian, Bill Reiss. Bill is an XNA MVP, who recently ported a popular physics engine from XNA to Silverlight. He has a ton of XNA tutorials on his site. I'm looking forward to pouring over some of his content.

    Finally, I want to put in a good word for the guys at eRain (I forgot to ask them their names!) They were genuinely friendly, and it really excites me to see a company like that being successful. I'm looking forward to seeing ZAM3D and Standout!

    All in all, I can't say that I learned much, but I really enjoyed meeting all these techies and sharing their passion. I was a little reluctant to post, because I don't want to seem like I'm dropping names to be cool. In the end, I decided to mention all the people that left an impression on me through out the day, not because I want to be cool, but because they are cool and it's both good and fun to get a chance to meet them.

  • My Favorite Keyboard Shortcuts

    I'm such a wannabe ReSharper padawan. My motivation is good though: I want to be more productive.  On a recent project, I was writing some code in front of a client employee, a novice developer himself, and he exclaimed "The code is just writing itself." 

    I learned a long time ago that I could impress my clients by navigating without the mouse, more recently I learned that I could get more work done without it.

    Enough talk, here is my current set of favorite keyboard shortcuts.  Some are ReSharper (R#) and some are Visual Studio (VS).

    VS Ctrl+K,C Comment out a block of code
    VS Ctrl+K,U Uncomment a block
    VS Ctrl+K,D Format your code, I prefer R#'s version but this is handy for XML.
    R# Ctrl+Shift+R Presents a context-sensitive menu for refactoring.  This is a must for newbie ReSharper padawans.
    R# Alt+Enter Another padawan must; this present recommended refactorings, e.Shiftg. inserting a namespace, changing accessibility of a member, etc.
    R# Alt+Insert The 3rd padawan must; this helps you insert "missing" code and is essential for TDD.
    R# Ctrl+Alt+Shft+F It's a handful, but it reformats your code.  This can sometimes be a bit much, and can cause some unnecessary churn in source code repository. (I do it without thinking.)
    VS/R# Ctr+Space Did you know that R# will even suggest variables names?  Isn't that totally sweet? Yes. Yes it is.
    R# F6 Moves a class, either to a new namespace or (my favorite) to a new file.
    R# Alt+F7 Find usages.
    R# Ctrl+Left Click I was giddy when I discovered this.  This is equivalent to Go To Definition.
    VS Ctrl+- That's the minus key.  It's like the back button in your browser, it takes you back to the last file you were editing.  This is incredibly useful when you are writing a test, you insert a member into the class under test, and you want to jump back to the test.  w00t!
  • REMIX07: are you going to be there?

    Rob and I are heading to the REMIX conference in Boston.  I'm really excited about the trip (I worked in Burlington, MA in 96/97 and really fell in love with the area.)  I'm hoping to pack away as much Silverlight knowledge as I possibly can while I'm there.

    If anyone else is going to be there and you'd like to hang out, drop us a line. For better or for worse, I'm always in the mood to talk about technology.

More Posts

Our Sponsors

Red-Gate!