Related questions
Where do I put try/catch with "using" statement?
Possible Duplicate:
try/catch + using, right syntax
I would like to try/catch the following:
//write to file
using (StreamWriter sw = File.AppendText(filePath))
{
sw.WriteLine(message);
}
Do I put the try/catch blocks inside the using statement, or around …
How using try catch for exception handling is best practice
while maintaining my colleague's code from even someone who claims to be a senior developer, I often see the following code:
try
{
//do something
}
catch
{
//Do nothing
}
or sometimes they write logging information to log files like following try catch …
Why catch and rethrow an exception in C#?
I'm looking at the article C# - Data Transfer Object on serializable DTOs.
The article includes this piece of code:
public static string SerializeDTO(DTO dto) {
try {
XmlSerializer xmlSer = new XmlSerializer(dto.GetType());
StringWriter sWriter = new StringWriter();
xmlSer.Serialize(sWriter, …