As a VC++ programmer, what should I look out for when using C#

Platform: WinForms| Category: from MFC

1] The conditionals in if-statements must calculate to a boolean value. You cannot write something like

if (nUnits)  {    ...   } 

where nUnits is a int.

2] All code must reside in a class. There are no global variables per se.

3] Bitwise & and | operators can be used with boolean types as logical operators. The && and || operators are also used, and do have the ‘short-cut calculation’ behavior found in C++. The & and | operators do not have this ”short-cut calculation’ behavior.

4] Pointers are not available in managed code.

5] In managed code, destructors are not hit immediately when as object goes out of scope. Ie, there is no deterministic destruction.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.