Simple but Interesting Features of VS2010 and C# 4.0
codeproject.com
codeproject.com
Hiding Code: I've got an idea. If you've got to hide code, maybe it _doesn't belong in that class_. Single responsibility people.
String.IsNullOrEmpty(): Wow! Thanks MS for saving me from writing one 4 line helper method. What would be useful is if you provided these helpers for the other 90 that I need every project. Seriously, any C# dev can provide you with their "utility" project that has them.
Named Parameters & Defaults: Awesome!..... unless you need something other than a primitive, in which case you can't set default values, since it's nothing but a fancy compiler trick.
I like C#, but really, there's not much they've added since Linq that's really crazy interesting. Not that there isn't, but most of it isn't listed in this article.
Say for instance, I'm working on two methods that are expansive, but i'm trying to debug a small part of those methods. To make watching breakpoints and tracking flow easy I hide all but the necessary parts of the code.
I use regions in pretty much the same way - once I have a certain region of functionality locked down and tested, I hide it so I can focus on the part that's still being developed / tested.
I understand this is a religious argument of the code world and you're likely to disagree with me. I'm fine with that.
You could argue that I should re-factor the whole thing to avoid this issue, but certain design decisions made by someone else make this a huge change, and in the world of risk adverse enterprise applications that is not going to happen.
I totally agree on being practical and not refactoring methods that work correctly. But if you find yourself in the monster methods making changes quite often, it seems irresponsible to not refactor and leave the camp ground cleaner for the next time you or someone else comes through it.
Generally I agree. If possible clean it up, but quite often its a small one line change, which needs to be fixed ASAP, so there is little chance to refactor.
In a similar way, I like only looking at the code that's relevant - if the method I'm working on is larger than a single screen (which happens with comments and such included) I like collapsing parts I don't care about. I don't, strictly speaking, need to in order to work effectively but I like to - as you said, more of a religious argument than a quantifiable one.
Wrong. If your class/code/file is so big that you need to hide code to be able to easily navigate (or worse, understand) it, the author was doing something wrong.
You can use tools like this to make it right.
The nice part about named params is that it can make your code more clear if you have a lot of parameters on a method... but you could do the same thing by introducing a parameter object and be as clear and more resistant to change.
VS wise the power tools have some fun features, auto brace completion and auto semi-colon insertion when you do shift-enter from anywhere on the line.
See http://blogs.msdn.com/b/ericlippert/archive/2011/05/19/optio...
Yes I'm a little bitter because I had to learn the disgustingly ugly syntax that is C# when I recently switched jobs.