New Job, WPF Training Books and more

Hello everyone!

It has been quite a while since my last blog post so its time for me to get back into the fray starting off with a couple of big announcements.

New Job!

So my first big announcement is that I have a new job.  Magenic is a great place and I am definitely sad to go, but an opportunity fell into my lap that I could not refuse.  The name of the new company is called Veracity Solutions.  I will technically be an independent sub-contractor working for my and my wife’s company Intuex., Inc..  Veracity works to find and sell projects and then partners with highly skilled independents to provide the development effort.  A lot of the other consultants I have talked to have their own companies with multiple projects both from Veracity and their own efforts.  I will get to work from home mostly which definitely makes me a very happy camper.  There is also great potential for learning as I will join the ranks of some very very skilled individuals.  I am hoping soon to get a website for our company Intuex sometime in the near future, so look for it!

WPF Training Videos

My second big announcement is that soon Sams Publishing will be releasing a set of WPF training videos through their LiveLessons brand.  I have recorded 20 videos spanning about 7-7.5 hours ranging from basic introduction to key WPF concepts to some of the more advanced topics like Custom Controls, Localization, Navigation and of course MVVM.  I am hoping to get the videos for final author review this week and I have marked them as complete after possibly some tweaks it’ll just be a short time before they are released.  I believe that they will be released on Safari so if you already have an account you can easily get to these videos.  I believe they will also be sold on InformIT but I am not 100% sure of this.

So look forward to these videos and I definitely welcome feedback and criticism on them!

Razre 2

Another thing I have going on in my head is to start working on Razre 2.  Back a year ago I had wanted to build a WPF Application Framework that provided out of the box a lot of stuff that helps out when building WPF applications, not just another MVVM framework, but also providing many many more things to help with like navigation, themes and some other useful tools.  Well I had my initial release and then got very busy so I never came back to it.  A lot has changed since then and there are a few things I would now do differently so I think I am going to start over with Razre 2.

I intend Razre 2 to be compatible with not just WPF but also Silverlight and hopefully a mobile version for Windows Phone 7.  I have a lot of ideas on what I want this framework to support but I have to get them all wrapped around in my head.  Whether or not I actually get started on this project is another story but i would definitely consider bringing in others that would be interested in working on a project like this.  Lets hope this gets off the ground and look forward to seeing the results!

C# Optional Parameters and Generic constraints

So since I haven’t posted in a while I figured I would include something technical. I would like to share this nifty little piece of information I figured out about C# optional parameters when combined with generic constraints.

So first I want you to just look at the code sample below; do you think it would compile?

public void SomeMethod<T>(T something = null)
    where T : ISomething
    if (something == null)

The correct answer is that no it will not compile.  This is the error you get if you try to compile this.

A value of type ‘<null>’ cannot be used as a default parameter because there are no standard conversions to type ‘T’

So basically what I am guessing is that it cannot determine if T is nullable based on all possible incoming types constrained to the interface.  What’s weird though is that the IF statement right below it compiles just fine.  Based on the constrained interface the IF statement will allow a null check but the optional parameter doesn’t?  That’s a little strange if you ask me.

Fortunately if you need something like this there is a solution!  All you have to do is change T something = null to T something = default(T) as such.

public void SomeMethod<T>(T something = default(T))
    where T : ISomething
    if (something == null)

So now this tells the compiler to resolve the default of T which in almost every case will resolve to null.  The only time this may not happen is if you have a struct that implements this interface, otherwise you know its a normal object type so you can do a null check.

By using default(T) this allows us to have optional parameters in C# that are constrained to an interface which to me is pretty useful in some cases.


Well I am hoping to be back to being more active on my blog and some other community events now that the big things like my training videos and this new job are over.  I hope you enjoy this and have a great day!

  1. #1 by Joel Cochran on October 22, 2010 - 3:33 pm

    Hey Jason, great to see you posting again!

  2. #2 by Jason Rainwater on October 23, 2010 - 8:24 am

    Thanks Joel, its great to be back again :)

Comments are closed.