1
vote
1answer
224 views

catch(Exception ex) would this example be a code smell? [duplicate]

We have production code that is not easily deployed in a test area. We also have a new library of code that we would like to "plug in" to the production code. The production code would be making a ...
16
votes
5answers
11k views

Multiple classes in a single .cs file - good or bad?

Is it advisable to create multiple classes within a .cs file or should each .cs file have an individual class? For example: public class Items { public class Animal { } public class ...
55
votes
16answers
7k views

Are #regions an antipattern or code smell?

In C# code it allows the #region/#endregion keywords to made areas of code collapsible in the editor. Whenever I am doing this though I find it is to hide large chunks of code that could probably be ...
7
votes
10answers
1k views

Property-coalescing operator for C#

The null-coalescing operator in c# allows you to shorten the code if (_mywidget == null) return new Widget(); else return _mywidget; Down to: return _mywidget ?? new Widget(); I ...