简体   繁体   中英

What to learn next: F# or LINQ

Just started to get my feet wet with C# and .NET, liking it so far. I think I've got the main gist of the C# language constructs, so what technology should I dive into next: F# or LINQ?

I'm aiming for both "broadening my horizont" programming-wise AND for "Enhancing my resume" in no particular order.

UPDATE: From reading your replies I'm so far leaning towards learning LINQ, since that is a "must for all .NET programmers". I'm leaving the question open for a bit, just to get some more oppinions. Thank you for your answers.

UPDATE 2: Ok, so from reading your responses it would seem LINQ has the easiest learning curve, and applies to C# and F# both, so time spent with LINQ is not "wasted" even if I go with F# eventually. Thanks again for your answers.

与F#相比,LINQ不是编程语言,但你应该学习LINQ,因为它会让你在C#和F#中的生活更轻松。

It depends on what you need to do.

If you want to build WPF applications or ASP.NET or Silverlight applications for the Internet, dive further into C# and LINQ. If you want to build scientific, financial number-crunching applications, go with F#. If you just want to have fun, go with both :-)

Note that the effort needed to learn LINQ and the effort needed to learn F# are orders of magnitude apart: LINQ is essentially just a library and special syntax for building queries, and if you are used to writing SQL you will find it very easy to grasp. On the other hand, if you are used to imperative programming in languages like C#, mastering F# will require a paradigm shift. Thus, F# is also the technology which will broaden your horizon the most (depending on your current skillset of course).

Linq and F# are very different.

F# is a language on its own, but linq is a tool, or feature you can use in the language.

Linq is fantastic and will simplify your development in a lot areas and and make you more productive in the long run.

Linq is a must for all dotnet developers.

Here is a link showing some of the ways you can use linq Linq 101

I spent some time with F# as a hobby before I had the opportunity to learn C#3 for work. It turned out that I already used LINQ heavily in my F# code without knowing it in the form of sequence expressions. When I got to know LINQ, I immediately recognized it, and also immediately understood the principle of deferred execution.

So if you learn F#, you already know LINQ. You then only need to look up the syntax.

Besides that, learning how to program idiomatic F# will teach you how to think like a functional programmer. Knowing how to program with recursion, memoization, and immutable values will also aid you in building cleaner C# code (with LINQ of course). That's my experience.

LINQ (Language Integrated Query) is a small embedded language within C# it allows you to deal with collections of objects in a very natural way eg

int[] numbers = new int[] {1,2,3,4,5,6,7,8,9};

var smalloNumbers = from n in numbers where n < 10 select n;

This is valid C#, LINQ is simply another feature of the language, one that it happens to share with VB. Related technologies use LINQ to access database store (LINQ-to-SQL LINQ-to-NHibernate etc) or other interesting services (such as amazon or ebay etc) but LINQ itself can be learnt from within the language of C# itself (LINQ-to-objects) without having to play with databases or anything like that.

F# on the other hand is a full "functional" language and whilst being a general purpose language is especially good at dealing with large collections of things, map-reduce style problems and recursive processing.

So, in summary I would recommend picking up LINQ first along with the other language features in C~ you may have missed (LINQ will also guide you through Lambda expressions, anonymous types and the var keyword if not yet encountered) and then move onto F# as a new learning project at a later date. As a C# developer I use LINQ every single day in my code.

I hope that helps.

IMHO

F# and then LINQ

他们俩都很高兴。

Why not other frameworks in the .Net space like WCF, WPF, ASP.net MVC, some .Net ORM etc.? F# is for functional programming language on .Net platform. If you haven't used another functional programming language, it's a different paradigm and the learning curve will be steeper than that for LINQ. The best way to learn LINQ is IMHO to use it on a toy or real-life project where you are using C# and SQL server database. LINQ does not have much new syntactic sugar.
On the other hand, while the above applies to learning F# too, you can solve any programming exercises or project Euler like puzzles using F# to become familiar with the programming constructs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM