C#是否具有太多的语言功能? [英] Does C# have too many language features?

查看:91
本文介绍了C#是否具有太多的语言功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我们团队中不时弹出的讨论.虽然一些人很快学习了C#3.0功能,但其他人仍坚持经典技术.

This is a discussion that pops a from time to time in our team. While a few quickly learned C# 3.0 features, other stick with classical techniques.

有些人从不使用Linq,认为lambda表达式令人困惑,并且yield是"scary".有时,他们几乎无法理解使用所有新功能的人编写的代码.我们可以说他们不精通该语言,应该学习它.

Some never use Linq, think that lambda expressions are confusing and yield is "scary". Sometimes they can hardly understand code that is written by people using all the new features. We can just say that they do not master the language and should learn it.

但是学习现代编程语言应该有多困难?每个人都可以解决问题,每个人每天都有许多其他问题需要解决,而不是关心更好的实现方法.培训人不是免费的.另一方面,语言功能可以使人们提高工作效率,并提高代码的可维护性.

But how hard should it be to learn a modern programming language? Everyone can solve the problems, everyone has many other problems to solve every day than to care about nicer ways to implement it. Training people is not for free. On the other hand, language features can make people more productive and code more maintainable.

C#功能列表可能不完整

Probably incomplete list of C# features

  • 类,结构,基本类型,数组,装箱,接口,继承(抽象,虚拟,新建,密封),属性,可为空
  • 例外
  • 泛型
  • 多线程,锁
  • 反射
  • 代表,事件,匿名代表
  • 迭代器
  • lambda表达式
  • 扩展方法
  • linq
  • classes, structs, primitive types, arrays, boxing, interfaces, inheritance (abstract, virtual, new, sealed), properties, nullables
  • exceptions
  • generics
  • multi threading, locks
  • reflection
  • delegates, events, anonymous delegates
  • iterators
  • lambda expressions
  • extension methods
  • linq

版本4即将推出,其中包括许多其他功能.

Version 4 is coming soon including many additional features.

我个人喜欢C#的几乎所有功能,并且喜欢用这种语言编写的简短漂亮的代码.但是我不必从头开始学习.

Personally I like almost every feature of C# and like the short and nice code I can write with this language. But I don't have to learn it from scratch.

我对您的意见以及您学习或教C#的经验感兴趣.功能已经太多了吗?仍然缺少重要功能吗?语言功能使该语言更易于使用还是更难学习?

I'm interested in your opinion and your experience with learning or teaching C#. Are there already too many features? Are still important features missing? Are the language features making the language easier to use or just harder to learn?

:没有答案,例如语言A比语言B更好,因为...".

Please: No answers like "Language A is better than language B because...".

推荐答案

是的,这是一种风险-并在 lot 中进行了讨论.到了非常很难从头开始使用C#的地步.幸运的是,情况有所稳定,并且C#3.0和C#4.0之间的语言更改相对较小.

Yes, it is a risk - and it gets discussed a lot. It is getting to a point where it is very hard to pick up C# from scratch. Fortunately, things have stabilised a bit, and the language changes between C# 3.0 and C# 4.0 are relatively minor.

实际上,我最近做了很多工作,试图修复

Actually, I've recently been doing a lot of work trying to fix a CF generics problem, and as part of the fix it might actually happen that the code reverts almost to C# 1.2 techniques (no, or very few, generics). So most problems can be addressed with the simpler language constructs. The point is: how hard should it be to do something?

例如-匿名方法以相对较少的复杂性添加了很多好处. dynamic(4.0)为COM互操作方案添加了更多内容.对于LINQ风格的代码,迭代器块是无价的.

For example - anonymous methods add a LOT of benefits for relatively little complexity. dynamic (4.0) adds some more for the COM interop scenarios. Iterator blocks are invaluable for LINQ-style code...

我看到了很多有关C#不重要部分的问题,我想我很难从头开始教C#的初学者 all .像Jon在Depth上的C#之类的书籍对于已经了解基础知识的人来说是不错的(至少C#1.2;理想情况下是一些C#2.0)-但这并不是真正为新手设计的(我知道Jon不会不同意).

I see a lot of questions about the non-trivial parts of C#, and I think I would struggle to teach a beginner all of C# from the ground up. Books like Jon's C# in Depth are good for people who already know the basics (at least C# 1.2; ideally some C# 2.0) - but it is not really designed for newbies (I know Jon won't disagree).

确实是一个棘手的人.幸运的是,C#团队设定了很高的标准(包括在内). 非常有用以使其成为语言.

A tricky one indeed. Fortunately, the C# team set the bar (for inclusion) very high; something new has be be very useful to make it into the language.

这篇关于C#是否具有太多的语言功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆