C# snippet: Add CommonAssemblyInfo.cs as link to all C# projects.

We use a CommonAssemblyInfo.cs file, to contain all common AssemblyInfo information for all projects. Like: [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyCompanyAttribute("ADA ICT")] [assembly: AssemblyCopyrightAttribute("Copyright © ADA ICT 2014")] Our continuous integration system, alters the CommonAssemblyInfo.cs file add build time, to sync the TFS build version with the assemblies found in …

Casting when dealing with nullable fields in a SqlDataReader

When dealing with nullable fields in a SqlDataReader, use: int? field_a = reader["field_a"] as int?; string field_b = reader["field_a"] as string; instead of: int? field_a = Convert.ToInt32(reader["field_a"]); string field_b = Convert.ToString(reader["field_a"]); http://stackoverflow.com/questions/2141575/how-to-efficiently-convert-cast-a-sqldatareader-field-to-its-corresponding