Jul
17th | 2008

WPF Binding Converter Best Practices

Posted by Amit |
Filed under WPF |

Hi all

As you all remember in my article about Custom WPF Context Menu I mentioned that my WPF Binding Converter was a singleton, and I promised to tell you why, so here comes the 3 ways I know of using WPF Binding Converters. We will start from the worst (in my opinion) and move on the the best.

To start off here is the Binding Converter:


Continue Reading...
Jul
16th | 2008

Coding Conventions - Prefix For Class Members

Posted by Shahar Y |
Filed under .Net, C#, Unmanaged Code |

A week or two ago, I read an interesting article in Coding Horror called The Problem With Code Folding. Let me quote the beginning of this post:

When you join a team, it’s important to bend your preferences a little to accommodate the generally accepted coding practices of that team. Not everyone has to agree on every miniscule detail of the code, of course, but it’s a good idea to discuss it with your team and decide on overall approaches and philosophy beforehand. It promotes team harmony, and more than that, it’s just common courtesy. As they say, when in Rome, do as the Romans do. 

Jeff Atwood is talking about the fact that it is important to obey the coding conventions and practices of your team. Every one of us as its own preferences but as a team we need to have some rules, we all should work with the team, not against it. I must admit that I totally agree with Jeff’s attitude, no questions about it.

But, in addition to what was said before, Jeff continues:

Still, there are some coding preferences people may feel.. strongly.. about. If that’s the case, try to clear the air and address those strong preferences up front, as early as possible. Don’t let them simmer. For me, the use of #region is one of those things. I tried to make myself clear in this twitter message: No, I will not use #regions. And no, I DO NOT NEGOTIATE WITH TERRORISTS. Shut up.

I am not going to talk about the #regions issue, but to have my own say about another coding preference:


Continue Reading...
Mar
26th | 2008

A New Pattern for Event Declaration

Posted by Amit |
Filed under .Net, C# |

We all know the pattern to declare an event in C#, fairly easy, here is a remainder:
1: public class EventTest
2: {
3: public event EventHandler MyEvent;
[...]


Continue Reading...
Mar
14th | 2008

How to Get Visual Studio to Create New Classes Public by Default

Posted by Amit |
Filed under .Net, C#, Visual Studio |

This is a good one!
Every one knows that when you add a new class to a project it is private by default, but still when you compile for the first time, the compilation fails and only then you remember to add the “public” before the class name. Tired of this? Here’s what you do in [...]


Continue Reading...

Search Dev102