Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
3 answers
436 views

C# Duplicated usage of an if/else condition and a ternary operator. A good practice?

I had a debate with a work mate regarding the following code as to which one of it would be the better practice: My code (in pseudo): var A = <precondition either TRUE or FALSE>; var B; if(A) { ...
Chams's user avatar
  • 29
18 votes
3 answers
2k views

Should wrappers compare as equal using the == operator when they wrap the same object?

I'm writing a wrapper for XML elements that allows a developer to easily parse attributes from the XML. The wrapper has no state other than the object being wrapped. I am considering the following ...
John Wu's user avatar
  • 26.9k
12 votes
11 answers
13k views

Examples of operator overloading, which make sense [closed]

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 ...
Paweł Sołtysiak's user avatar