Do you use resource file to store all the messages and globlal strings?
Last updated by Tiago Araújo [SSW] over 2 years ago.See historyStoring all the messages and global strings in one place will make it easy to manage them and to keep the applications in the same style.
Catch(SqlNullValueException sqlex)
{
Response.Write("The value cannot be null.");
}
Bad example - If you want to change the message, it will cost you lots of time to investigate every try-catch block
Catch(SqlNullValueException sqlex)
{
Response.Write(GetGlobalResourceObject("Messages", "SqlValueNotNull"));
}
OK example - Better than the hard code, but still wordy
Catch(SqlNullValueException sqlex)
{
Response.Write(Resources.Messages.SqlValueNotNull); 'Good Code - storing message in resource file.
}
Good example