8
votes
4answers
1k views

Instantiating Null Objects with Null-Coalescing Operator

Consider the following typical scenario: if(myObject == null) { myObject = new myClass(); } I'm wondering what is thought of the following replacement using the null-coalescing operator: ...
11
votes
11answers
5k views

Examples of operator overloading, which make sense

While I learning C#, I found that, the C# supports operator overloading. I have problem with good example which: Make sense (ex. adding class named sheep and cow) Is not an example of concatenation ...