[Tech-Ed] DEV320 Visual C# Best Practices: What's Wrong With this Code?

Good presentation - disguised a best practices talk as a quiz to keep it interesting. Much tougher to spot the problems then to nod along with a bullet points about writing good code.

Not gonna try to summarize this - just point you the the slides. They're pretty self explanatory, you can get through them in a few minutes, but you'll get more out of them if you try to spot the problems before going to the next slide to see the answer.

Good stuff on exception handling, resource management, performance issues, and some sources of nasty bugs.

Okay, just one thing - did you know you can cast an arbitrary int (or whatever the underlying datatype is) to an enum without generating any kind of error?

enum EmployeeType {Grunt, Manager, Executive }
EmployeeType text = (EmployeeType) 50000;

No Comments