问题描述
C#有目前的良好势头。什么是你的需求的有顺序切换(或退货)到Java的特点是什么?
C# has a good momentum at the moment. What are the features that you would need to have in order to switch (or return) to Java?
这也将是如果相当有用人们张贴这些解决方法对于当前的Java版本,例如: Nullables被缠自定义类,使之成为一个更有趣的wiki。
It would also be quite useful if people posted workarounds for these for the current Java versions, e.g. Nullables being wrapped around custom classes, to make this a much more interesting wiki.
推荐答案
作为一个.NET / C#开发这里缺少的功能,激怒了我。这个列表中没有特定的顺序 - 就像想法浮现在脑海中:
As a .NET/C# developer here are the missing features that annoy me. This list in no particular order - just as thoughts come to mind:
- Java库太小。对于常见的事情,我有竞争的开源产品,因为缺乏在许多方面的基本库。
- 这是一个面向对象的编程语言右5之间做出选择?为什么在赫克基本类型不能从对象继承?
- 指针
- Lambda表达式
- 瓶盖
- 部分类和程度较轻的部分方法
- 仿制药
- 实时支持使用语句和处置 - 这对我来说是真正的跆拳道。你真的要在try / catch块明确关闭连接。 Java的可怜的家伙!
- 的将是不错
- 无符号整数 - 再次跆拳道?我必须使用数字类型大于我需要什么目的一遍吗?
- 在Java中,你可以从try / catch语句的最终块将返回。一位同事通过引入一个bug这样混淆了地狱了我几个小时。这种行为应该被禁止在C#。
- The Java library is too small. For common things I have to choose between 5 competing open source products because the base library is lacking in so many ways.
- This is an Object Oriented programming language right? Why in the heck do primitive types not inherit from "object"?
- Pointers
- Lambdas
- Closures
- Partial Classes and to a lesser extent partial Methods
- Real support for Generics
- Using statements and Dispose - this was a real WTF for me. You really have to explicitly close connections in try/catch blocks. Poor Java guys!
- Yield return would be nice
- Unsigned integers - again WTF? I have to use number types larger than I need for what purpose again?
- In Java you can return from final blocks of try/catch. A co-worker confused the hell out of me for hours by introducing a bug this way. This behavior should be prohibited as in C#.
我很少有使用Java,当我这样做,我有各种WTF时刻
I rarely have to use Java and when I do, I have all sorts of WTF moments.
编辑:我删除了,每个基于事实的评论不再缺少的Java功能,因为1.5
I Removed for-each comment based on the fact it is no longer a missing Java feature since 1.5.
这篇关于哪些功能应该在Java 7起要鼓励从C#转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!