什么是用C#与F#或F#VS C#的好处? [英] What are the benefits of using C# vs F# or F# vs C#?

查看:1098
本文介绍了什么是用C#与F#或F#VS C#的好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一家高科技公司,做比产品出货更原型工作。我刚刚问什么是C#和F#,为什么MS创建F#,什么情况下会是比C#更好的区别。

I work for a tech company that does more prototyping than product shipment. I just got asked what's the difference between C# and F#, why did MS create F# and what scenarios would it be better than C#.

我一直在使用的语言有一段时间了,我喜欢它,所以我可以很容易地去了解F#的强大功能,但是我没有在C#中的经验,说为什么我们应该使用一个比其他。

I've been using the language for a while now and I love it so I could easily go on about the great features of F# however I lack the experience in C# to say why we should use one over the other.

什么是用C#与F#或F#VS C#的好处?

What's the benefits of using C# vs F# or F# vs C#?

推荐答案

在命令式语言函数式编程的一般优点:

General benefits of functional programming over imperative languages:

您可以制定很多问题要容易得多,更接近他们的清晰度和更简洁的一个函数式编程语言如F#和你的code是容易出错(不变性,功能更强大的类型系统,直观recurive算法)少。您可以code你的意思,而不是计算机要你说;-)的你会发现很多这样的讨论时,谷歌,甚至在SO进行搜索什么。

You can formulate many problems much easier, closer to their definition and more concise in a functional programming language like F# and your code is less error-prone (immutability, more powerful type system, intuitive recurive algorithms). You can code what you mean instead of what the computer wants you to say ;-) You will find many discussions like this when you google it or even search for it at SO.

特殊的F#效果 - :

Special F#-advantages:


  • 异步编程的非常的简单而直观的使用<一个href=\"http://blogs.msdn.com/dsyme/archive/2007/10/11/introducing-f-asynchronous-workflows.aspx\"><$c$c>async {} -ex pressions - 即使ParallelFX,相应的C# - code是更大

  • Asynchronous programming is extremely easy and intuitive with async {}-expressions - Even with ParallelFX, the corresponding C#-code is much bigger

很容易集成语言

扩展,你需要它的语言:<一href=\"http://blogs.msdn.com/chrsmith/archive/2008/05/30/language-oriented-programming-in-f.aspx\">LOP

Extending the language as you need it: LOP

<一个href=\"http://blogs.msdn.com/andrewkennedy/archive/2008/08/29/units-of-measure-in-f-part-one-introducing-units.aspx\">Units措施的

更​​灵活的语法

通常更短,更优雅的解决方案

Often shorter and more elegant solutions

看看这个文件

C#的优点是,它经常更准确的势在必行-applications(用户界面,命令算法)不是一个功能的编程语言,它采用的是势在必行的设计和它更wides $的.NET的框架p $垫。

The advantages of C# are that it's often more accurate to "imperative"-applications (User-interface, imperative algorithms) than a functional programming language, that the .NET-Framework it uses is designed imperatively and that it's more widespread.

此外,你还可以有F#和C#一起在一个解决方案,让你可以结合这两种语言的优势,并利用它们需要它们的地方。

Furthermore you can have F# and C# together in one solution, so you can combine the benefits of both languages and use them where they're needed.

这篇关于什么是用C#与F#或F#VS C#的好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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