Using a method pattern

What are the pros/cons of designing methods whenever possible like this? It would only apply to void return types, and make sure not to swallow any exception and other stuff like that.

if (!myClass.Method(out error)) { //error logic } 

then those void methods always when possible should follow:

public bool Method(out string error) { error = ""; try { //logic return true; } catch (Exception e) { error = e.Message; return false; } } 

by EiltisR via /r/csharp

Leave a Reply