Question: When checking if an object equals some value, is there some difference between:

```
myObject == someValue

```

or

```
someValue == myObject

```

In other words, does the order of the operands of the comparison operators matter? Is it a matter of coding style?

I have been using the former, but a project has been using the latter which I had never seen before.

For example

```
if (data != null)
    data.Write(writer);

```

or

```
if (null != data)
    data.Write(writer);

```

I have been using the former, while some member in the project has been using the latter.

Thanks.

Answer: 
I don't think there's any difference, or at least not one that the compiler wouldn't optimize to the same thing anyway.

What you're observing are often called [Yoda Conditions](https://en.wikipedia.org/wiki/Yoda_conditions). (Because of the linguistic style of what the conditions sound like when spoken aloud, being similar to how Yoda speaks.) And they're mostly a matter of personal preference.

People who advocate them are quick to point out advantages, for example:

```
if (something = true)

```

would produce a runtime bug, whereas:

```
if (true = something)

```

would produce a compiler error and be caught immediately. Though I would counter-argue that unit tests should have found the error before it got far anyway. And would equally argue that any confusion from other programmers on the team (even just the idle curiosity of you posting this question) is time lost on the project. But I digress :)
They are the same in my opinion. If I say:

```
(1 != 2) = true

(2 != 1) = true

```

Both will result in the same answer. The only thing I can think of that would matter is if where you work there is a coding standard that requires one way or the other (I have never seen a coding standard like that). I would stick with the same way the current project your working on is doing it.