Hi,

IMO, change your convention. This mistake is only possible in C# if
foo is a boolean, but in that case you shouldn't even be doing this to
begin with, but just a simple if (foo) or whatever.

Regards,
Alex

On Tue, Aug 9, 2011 at 7:54 PM, Vlad <[email protected]> wrote:
> Hi,
>
> I have coding habits that come from C which seem to be violating some
> C# style guideline.
>
> I prefer writing:
>
> if (null == foo)
> {
>  DoStuff();
> }
>
> But it seems the rule does not consider the above as good a null check
> as
>
> if (foo == null)
>
> Which I consider bad because it is all too easy to drop an =.  C# only
> allows Booleans to be there, so should I change my convention?.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Gendarme" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/gendarme?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Gendarme" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/gendarme?hl=en.

Reply via email to