问题描述
在我的整个大学生涯我用Java来code项目,直到我开始工作,这是我不得不深入到C#的境界。虽然NET库是相当广泛的我不禁感到有东西在C#中失踪相比,Java的。我想知道,如果Java是比任何C#,反之亦然从专家那里更好。你会用什么来开发既复杂又相当琐碎的应用程序?有哪些优点和使用这些技术,2比其他的缺点是什么?
Throughout my university career I used Java to code projects until I started working which is where I had to delve into the C# realm. Though the .Net library is fairly extensive I can't help but feel that there is something missing in C# as compared to Java. I would like to know if Java is any better than C# or vice versa from the experts out there. What would you use to develop both complex and fairly trivial applications? What are some of the advantages and disadvantages of using these 2 technologies over the other?
推荐答案
多年来,C#在玩追赶与Java。与C#/结束。.NET 3.0 / 3.5,现在它的(大部分)的其他方式。什么C#Java那样呢?
For years C# was playing catchup with Java. That ended with C#/.Net 3.0/3.5 and now it's (mostly) the other way around. What does C# have that Java doesn't?
- 瓶盖;
- 运行仿制药;
- 原始类型的泛型(这个排序一百万个整数VS百万Integer对象名单基准揭示的改善3倍);
- 代表;
- 活动;
- LINQ
- 扩展方法;
- 一流的性能;
- 运算符重载;
- 索引器;
- 匿名类型;
- 防爆pression树木;
-
使用
块; - 否检查异常。万岁!
- 十进制类型;
- 作为C#4.0:在
动态
类型,它基本上是。
- Closures;
- Runtime generics;
- Generics of primitive types (benchmarks of this sorting a list of a million ints vs a million Integer objects have revealed a factor of 3 improvement);
- Delegates;
- Events;
- LINQ;
- Extension methods;
- First-class properties;
- Operator overloading;
- Indexers;
- Anonymous types;
- Expression trees;
Using
blocks;- No checked exceptions. Hooray!
- Decimal type;
- As of C# 4.0: the
dynamic
type, which is basically duck typing.
和Java有:
- WAY ,更好的方式枚举。 C#枚举只是INTS有条纹画下侧。 Java的枚举治疗与行为的对象是远远优于(恕我直言);
- 我知道这将是有争议的:更好的IDE ,特别是在code重构,其中的Visual Studio(没有ReSharper的)仍然远远落后的IntelliJ,Eclipse和甚至可能NetBeans的境界;
- 它运行在Linux上。单尽管如此,Windows是目前的.Net最大的阿喀琉斯之踵(恕我直言);
- 这是免费的。 Java的6 + Glassfish的Eclipse的+ + LINUX成本,你什么都没有。现在做同样与.net + IIS + VS + R#+的Windows Server ...;
- 恕我直言,Java 5的并发utils软件包仍优于任何形式的,我已经看到在C#中迄今为止并发工具;和
- 值得注意的是更多的开源项目,但铅正在迅速减少。
- WAY, way better enums. C# enums are just ints with a stripe painted down the side. Java treating enums as objects with behaviour is far superior (imho);
- I know this will be controversial: better IDEs, particularly in the realm of code refactoring where Visual Studio (without Resharper) is still lagging far behind Intellij, Eclipse and possibly even Netbeans;
- It runs on Linux. Mono notwithstanding, Windows is by far .Net's biggest achilles heel (imho);
- It's free. Java 6 + Glassfish + Eclipse + Linux costs you... nothing. Now do the same with .Net + IIS + VS + R# + Windows Server...;
- IMHO the Java 5 concurrency utils package is still superior to any sort of concurrency tools that I've seen in C# to date; and
- Significantly more open source projects but that lead is being rapidly diminished.
而可悲的是这就是所有我能想到的在Java列蜱。
And sadly that's about all I can think of for ticks in the Java column.
这篇关于编程的艺术:Java的VS C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!