Last update July 28, 2009

Coming From /

What D and C# have in common:
  • Have a syntax heavily influenced by C/C++.
  • Use garbage collection.
  • The "." operator is always used (instead of -> or :: operators)
  • Include null as a keyword.
  • Values are initialized before they're used.
  • Feature error handling using try-catch-finally.
  • Pointers are allowed (not that their use is encouraged).
  • goto is a valid command (if you need it it's there).
  • A 'foreach' operator, though they are slightly different. (See the differences section)
  • Inner classes
How D is different:
  • There is no VM in D. Everything is compiled to machine code.
  • In D, one can use integers to govern if statements.
  • D's modules are similar to packages, but symbols can be imported into the global scope.
  • You can use inline assembly in D.
  • D doesn't have an as operator. However, casting works like as: The c# code Cat cat = dog as Cat would be written as Cat cat = cast(Cat) dog; in D. (cat would be null if dog can't be cast to a Cat).
  • Instead of foreach (Foo foo in bars) (C#) you would write foreach (Foo foo; bars) - And if you wanted a variable set to the index number of the element being acted on, you can do foreach (int i, Foo foo; bars) in D.
More information:


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: July 28, 2009 1:23 (diff))