Coming From /
CSharp
Difference (last change) (no other diffs, normal page display)
Changed: 22,23c22
* ![]() * Languages vs. D |
* ![]() |
Changed: 25c24,31
* ![]() |
== Related = * Languages vs. D * ![]() * ![]() * ![]() * Language Specification * Development with D |
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
- 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.
Related
- Languages vs. D
D Transition Guide
Feature List
Rosetta Code: D category
- Language Specification
- Development with D