| 213 | |
| 214 | == Frequent Mistakes == |
| 215 | |
| 216 | * Use `Environment.NewLine` instead of the string constant "\n". |
| 217 | * Use `Path.Combine()` instead of string concatenation (with `\` or `/`) to combine directory and file names. |
| 218 | * Throw and catch specific exceptions, don't catch generic exceptions ~~`try { ... } catch(Exception ex) {}`~~ |
| 219 | * Use a finally block to make sure that the state of the program is consistent even when Exceptions are thrown. |
| 220 | * Set the mouse pointer back to normal in a finally {... } block. |
| 221 | * Use `string.Empty` instead of the string constant `""`; |
| 222 | * Use `string.IsEmptyOrNull(a)` instead of `if(a!=null && a!="")` |
| 223 | * Check for `InvokeRequired` in methods that manipulate GUI elements in controls. |
| 224 | * Instantiate all objects of classes implementing `IDisposable` with the `using(...) { ... }` statement to make sure the object is disposed correctly. |
| 225 | * When possible use LINQ syntax instead of extension methods for LINQ expressions. |
| 226 | |
| 227 | ---- |
| 228 | |
| 229 | == Final Remarks == |
| 230 | Use your brain! |