VS2005 Item Templates

Came across two solid articles today for using VS2005 Item templates. The first show modifying the out of the box templates: http://davidhayden.com/blog/dave/archive/2005/11/05/2556.aspx The second shows creating custom templates: http://codebetter.com/blogs/david.hayden/archive/2005/11/06/134343.aspx...


FxCop IDE Integration with VS2005 Professional Edition

VS2005 Team System has the capability of seamlessly integrating FxCop inside the IDE. This is also possible with non-Team System versions such as Professional edition by using External Tools - the FxCop documentation for this can be found here: http://www.gotdotnet.com/team/fxcop/Docs/FxCopCmd/FxCopCmd_VS.html So what happens if you want to have this convenient IDE integration but point your analysis at an *.FxCop project file rather than pointing directly to assemblies? The main thing you hav...


Nullable Data Readers

I recently submitted an article about Nullable Data Readers .NET 2.0 for review which was posted here: http://www.codeproject.com/Articles/12778/C-Nullable-Data-Readers As a quick supplemental example for that article, suppose you have a non-nullable type in your business object that you're populating with from a nullable field in the database (this might also happen when populated from an outer join). This is a good opportunity to use the new nullable coalesce operator (aka, conditional assig...


TryParse for Nullable Types

In my last post [https://stevemichelotti.com/parse-nullable-types/], I discussed creating a static class for Parsing nullable types. However, 2.0 also introducing a new TryParse() pattern so that developers would not have to rely on catching exceptions when attempting a Parse() method.  For example: https://msdn.microsoft.com/en-us/library/ch92fbc1.aspx We can incorporate the TryParse pattern into our NullableParser class as well so that our consuming code to look something like this: Da...


Parse Nullable Types

Often when working with a textbox or some other control, it is necessary to call the Parse() method to do a conversion for our business object property. For example, consider a web form where you are assigning: person.DateOfBirth = DateTime.Parse(txtDateOfBirth.Text); This is all well and good if your field is required and you've already got a UI validation ensuring that the user typed a date into the text box. But what do you do if the field is not required and you'd like to use Nullable fo...