What are the most common or vicious mistakes when experienced C++ programmers develop in C#?
struct
and class
in the twousing
alias and a typedef
int
? (it is actually defined in C#)using Hungarian Notation and other C++ naming conventions
private int m_iMyIntField;
class CWidget { ... }
Thinking that "garbage collection" = "I never have to worry about object lifetime at all". For instance, opening a FileStream
and forgetting to close it.
Or:
Confusing "pass by reference" and "reference type":
void GetAnArray(int input, ref string[] output);
(Compare with C++: void getAnArray(int input, std::vector<std::string>& output);
)