What is the best way to start learning C#? - c#

I have a little programming experience with vb 6 and vb.net not much. Please tell me the best way to become an expert C# programmer and I know it will take a long time.

Think about how you learn human languages - reading, writing, speaking and listening.
Read code. Read articles. Read examples. When you're more experienced, look at the source code for some projects that you use.
Write code. Play with the examples you've read about. Modify them. Solve problems from Project Euler. Think of your own projects then try to solve those.
Talk about code. Blog about it. Tell your friends about it. See if you can impress your grandmother with how good your program is. Now try to impress your professor. Learn how to communicate about programming with different types of people.
Listen to other programmers. Many of them have more experience than you and have useful things to say that you can learn from. Learn the vocabulary they use. Discuss your ideas with them.
Practice. Practice. Practice.
Google is your friend.

Start by downloading http://www.microsoft.com/express/ and start programming. If you don't have a project of your own or something someone else wants done, start looking up popular algorithms and implement those. Try implementing certain design patterns. This way rather then just focusing on syntax your learning a heck of a lot more about programming in general.

Even though I feel the other answers on this thread already well-cover the bases, in terms of replying to a pretty "nebulous," even "naive," question : I'm going to add another opinion (slightly too long to just be a comment).
I respectfully disagree with a few posts suggesting an analogy of learning a programming language to learning a spoken, or written, language. SO is not the place to discuss linguistic theory, and its relation to evolution, and cognitive structure, and the work of Chomsky, and Pinker, et. al., which suggest not only language learning's "innateness," but also how variation in "endowment" (genetic, and, yes, even "temperament"), and its dynamic interaction with environment, and "developmental windows of opportunity" at which learning can take place at phenomenally accelerated rates, contributes differentially to morphemic versus phonemic competency, etc.
But, please allow me just to register the hypothesis that there are many ways in which the analogy of learning a programming language to learning a spoken and written language is more of a "catch-all" that masks complexity, rather than a useful tool.
On the other hand, I suspect (hypothesis) that a person who has achieved mastery of more than one spoken/written language has, indeed, developed certain cognitive structures and skills that may be "useful" in learning a programming language.
To my mind the above two paragraphs are not inherently contradictory statements.
imho programming in general is also not analgous with learning mathematics or geometry which build structures up from axioms, or fundamental assumptions, into complex systems that sometimes can be "formally" proven, or validated. Of course there are some "rare birds" who start off from Knuth, or Gamma, et. al. and "Design Patterns," and "work their way down" to the "real world" :)
My "vote" goes with starting with a good book, and, as Mark Byers suggested, combining that with practice, testing yourself, taking on problems like those on the Euler project Mark mentioned, and, yes, certainly, also as Mark suggests, studying other people's code.
The question, in the beginning, though, is, imho : how to know which code is good to study.
For me the answer to that is : study the code examples provided by really good books like those by Jesse Liberty, for example : "Programming C#" latest (3rd.) edition from O'Reilly. Note : my understanding is the 4th. edition is due in March 2010.
imho Jesse has an unusual gift as a teacher of programming languages, an ability to "pace" the introduction of material in a skilfull way, to select and present the right examples in the right sequence, and remarkable gifts of clarity in his technical writing.
CodeProject articles are a great resource for code examples to study. Look for articles in areas that interest you that have a very high rating by other users, and are specific to C#.
The lesser-known book by Liberty "C# 2005 : A Developers's Notebook" is a fantastic resource (also, imho, one of the most fascinating books in terms of graphic design and book structure, ever done in any technical arena). It's a series of "exercises" that I would compare to the idea of "etudes" in music : each exercise demonstrates a topic, challenges you to understand a good example of that topic, and each topic is really something that will be useful in your "real-world" programming.
imho, once you have your "feet on the ground" with a hundred hours or so of study and practice of .NET : fly, don't walk, to the "guru-level" with Jon Skeet's "C# in Depth" published by Manning. He also, imho, is a superb technical writer who shares with Liberty the gift of selective presentation of material, and has his own special, unique, gift for "stepping out of the book to speak to you directly," addressing the kinds of concerns you are probably thinking about as you encounter more difficult material. I should note that I feel I am a long way from mastery of the content of this book, which just whets my appetite for understanding it. There's an element of wit and humor in Skeet's writing that also, in my experience, is extremely rare in technical books.
Please note : disclaimer : while I have worked as a paid consultant for Addison-Wesley on the technical editing of two major .NET books, I have never worked for O'Reilly or Manning, or received "comp" copies of their books (dammit :).
I must, respectfully, disagree with the recommendation of "C# in a Nutshell" by Albahari and Albahari (also O'Reilly; I believe 4th. edition is out now : I have only seen 3rd. edition) above : I think it would be a very inappropriate tool for a newcomer to .NET. On the other hand, when you get to studying Linq : you'll find, imho, that Albahari's website and free version of LinqPad is just the coolest thing ever done for helping you "get into" and explore Linq.
Good luck !

The same way you learned VB6 and VB.NET, no doubt. Pick up a book, and start reading. There's nothing radically different about it that requires any esoteric approach to learning. Just good old fashioned squatting in Barnes and Noble for a few hours before breaking down and buying a book. You could also mosey around http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx and read up a bit.
If you've already been using VB.NET, C# should come pretty natural to you. The syntax will be different, but the objects, methods, etc will all be familiar. Check out the tutorials on MSDN for C# too: http://msdn.microsoft.com/en-us/library/aa288436(VS.71).aspx
Oh, and welcome to StackOverflow!

If you're already familiar with other programming languages, the O'Reilly "In a Nutshell" books are generally a good place to start. "C# in a Nutshell" is both a good introduction and a good reference.

Download Charles Petzold's .NET Book Zero and read it through from start to finish, skip nothing even when you think you a fair bit about a particular area.

Related

migrating to C# from Java

I saw a thread similar to this, but the reason I'm asking this is because my situation is different.
I've been a tester (automated and manual) but I have a good Java programming knowledge although I haven't worked as a programmer.
My company is considering to move me to a C# programming role. Will it be hard for me to learn C# without any prior experience in programming?
Thanks
My 2 cents is that once you understand core concepts of programming you can move to any programming language. Try and remain as language agnostic as possible.
Specific to your question, you should be able to make the transition without much effort at all.
C# and Java are so similar you won't have any problems at all. That said, there are a few differences, this page does a pretty thorough job of demonstrating them.
One thing it doesn't mention is LINQ, which is definitely different as we're seeing the two languages start to diverge a bit more.
I have difficulties combining the statements "I have good Java programming knowledge" with "without any prior experience in programming". How can you have good Java programming knowledge without any experience in programming?
That said, if you are an able Java programmer, moving to C# should not be very difficult.
Speaking strictly about syntax, C# pretty similar to Java so you should have no problems there (at least it will feel familiar at first).
Moving to C# will not be a problem at all.
Since you already know Java, you'll find many concepts in C# easy to understand.
In fact, it's always a great thing to learn and work on multiple languages throughout your career, especially if they cover different paradigms.
I've had 4 programming jobs in my life, and for 3 of them I had no experience at all with the language before starting the job. The 1 for which I did have experience ended up being a complete disaster of a workplace.
If there's any correlation between how well you know a specific programming language before taking a job, and how you can get/do a job at a place where they use that language, I have yet to see it in my 10+ years. I'd say it's probably one of the least important factors contributing to your success.
Unless you plan to work at a company for a very short period of time, you'll learn many new things, and probably new languages, while working there. Whether you happen to know the one they're using now is like how tall Michael Jordan was when he was in high school: after a few dozen/hundred/thousand hours of practice, completely irrelevant.
Without any industry experience in Java it won't be easy to work in... Java. What I mean is you will have exactly the same difficulties in C# as you would have in Java. The language change won't be the problem -the big difference will be working with real world requirements and practices.
Don't take me wrong, I don't mean you will have problems: you'll just learn a lot of new things. If you have a solid "conceptual" base switching from Java to C# will be easy, I did the same pretty much effortless.
Read a good book (for ex. Troelson's Pro C#) and you'll quickly pick up the most important differences. Then with time you'll learn the other stuff that is really different from Java (for ex. WPF, Linq, etc.).
In conclusion, don't be afraid and go for it!
C# should be trivial to learn if you know Java. The differences at the programming level are largely syntactic for the most part.
The difficulty (and this is the same with Java) is the language is just an enabler for a large number of libraries and technologies. So you could have no trouble picking up C# but you might hit a brick wall learning WPF because there is no analog in Java. etc. Or you might be trying to write ASP.NET but you have never learned JSP / Spring in Java so have nothing to relate to.
The best strategy is start small, get familiar with the constructs and then try to implement something useful. e.g. in WPF, you could write a simple Twitter client using webservices. In ASP.NET you might write a simple blog app hooked up to database app.
Once you get the basics and assuming you follow best practice, it should be easy enough to expand outwards.
If you have programming knowledge skills it would be not very difficult to move into c#. In my experience coming from PHP I suggest you the following steps,
Books:
1- C# 4.0 in a Nutshell The Definitive Reference
2- Apress.Pro.ASP.NET.MVC.Framework
Tutorials:
1- check the website http://www.asp.net and probably the best thing could be to move directly into MVC
2- check the nerddinner tutorial http://nerddinnerbook.s3.amazonaws.com/Part1.htm in order to get in knowledge of how this work.
3- Download Nerddinner code http://nerddinner.codeplex.com/
4- use entity framework instead of linq based on MS election for the future
5- Download some starter-kits from http://www.asp.net/mvc/samples/mvc-music-store to check the way it work.
Hope it helps. brgds,

Is MSDN website sufficient for C# self-learning?

I know there are plenty of books on C#, but I'd rather learn by reading articles/guides and watching video tutorials. Would Microsoft's MSDN website be enough to teach myself C# in depth?
Thank you.
**Update*:*
#Jon Skeet: Thanks for your honest answer. I might just do that then, - I'll get Table of Contents from a C# .NET book and then go through each topic on MSDN.
Thanks again to all of you. I wish I could mark everyone's answer.
All the information is there, yes. Heck, the C# specification is available there, so that's all you need, in theory.
However - and I'm biased as the author of a C# book, of course - I believe that books add value by giving you a structured learning experience. Authors put a lot of time into working out the order in which to introduce concepts so that it makes the most sense.
Of course you could just take the table of contents from a C# book and then look up bits of MSDN in that order - but a good book will lead you through in a more orderly manner, building on examples and areas you've learned before rather than treating each one individually.
IMHO this will depend on your general programming level. If this is your first encounter with programming I think that a book would be better than MSDN. If on the other hand you have experience with similar technologies such as Java there's no reason MSDN wouldn't be enough as it contains extensive documentation, many tutorials and samples.
MSDN comprehensively covers all aspects of C# and the .Net platform. so Yes MSDN is sufficient to learn C#.
I would say so too, but only as a reference. That's what I did, and still do.
Edit: It might be hard for a beginner, but not impossible.
I think MSDN is a very good place to teach yourself C# in depth, that being said I don't think it's a good source to get you started.
Let me explain... MSDN is a great place when you want to work out how things work and why, what other options are there and all the rest of little details other sources usually overlook, but can be important. However, I think it lacks a certain "get up and do something meaningful" attitude you are looking for when learning a new language.
Just my 2 cents worth though.
Though I personally didn't learn it that way, there are some excellent resources on the MSDN now vs when I started with .NET.
In general, if you're going to learn C# from the MSDN, your launchpad will be here. If you're new to programming in general, here looks like a good place to start.
As far as I see it, there are articles about how to do things and articles about classes/methods, etc.
Some of the examples in articles about a class or method aren't enough for you to say that you know them and don't discuss everything, so I'd say they're a starting point - together with blogs and articles and tutorials on other sites you will probably get a lot more information.
The articles about how to do things, that start with a problem and show how to solve it, are ok and clear (or at least the ones I've read).
It also depends on what you already know and what you're building on.

AI Programming Resources with a focus on Web Applications

I'm interested in learning some AI algorithms that have a practical use in web applications eg. search, product recommendations etc. Obviously since I'm asking this question I am look for some more entry level material.
Any sort of useful stuff on the subject is good - books, blogs, tutorials, anything. My language of choice is c# so anything in that would be awesome but I'm happy to look at examples in other languages.
Toby Segaran's Programming Collective Intelligence isn't strictly an AI book I guess, but it does cover the kind of topics you're interested in (e.g. product recommendations, predictions, price modelling), and as a newcomer to the field I found it pretty accessible. It does sometimes skip over algorithmic detail in favour of "here's how to use this technique via an existing library" though; also the code samples are written in Python though it's clearly explained and easily translated to C#. It has a strong Web focus because, as the title implies, it deals with mining data from user-provided content, particularly on external sites such as eBay, etc.
I use AForge.NET in several projects. There are quite simple and fast implementations of genetic algorithms, neural networks, machine learning and so on.
It is an open-source project, so I can recommend it as a starting framework for any project using AI.
There is an excellent series of Google talks that will cover the foundations called Statistical Aspects of Data Mining. It's the same graduate level class that David Meese gives at Stanford.
The book Algorithms of the Intelligent Web by Haralambos Marmanis & Dmitry Babenko (Manning ed. 2009) provide a primer into this kind of things.
This book covers a rather broad spectrum of areas where "smarts" can be applied to web applications. Because of this, many topics receive at a rather superficial treatment, BUT each chapter includes very relevant references for digging further.
Also, code-wise, the working examples found in the book are made available in a code.google.com project (sorry however, mostly java, not C# as suggested in the question)
I cannot think of other AI resources specifically focused on Web applications, but many areas of AI-at-large are relevant the "intelligent web", in particular:
Natural Language Processing
[some] Neural Networks
Machine learning and classifiers
"Algorithms of the Intelligent Web" by Marmanis & Babenko. Hands down the best reference for what you need (based on your description). Yes, the code is written in Java but it is so clean and straightforward that you can probably transliterate it, into whatever you want, rather quickly.
In terms of search functionality it goes beyond indexing and describes, in-detail, PageRank, user click enhancements, and a PageRank-inspired ranking algorithm for plain documents (ASCII, Word, PDF) that the author called DocRank.
The book also provides, probably the best, practical coverage of recommendation engines, e.g. user-user, item-item, content based.

Time to transfer skills to java and resources

I'm thinking about learning Java. I'm already a more than competent c# developer. Has anybody else been in a similar situation? Roughly how long (whilst doing a typical 9-5 job) did it take you to transfer your skills? What resources would you recommend?
(When talking about resources, I specifically mean resources aimed at developers who want to learn Java, not newbie material)
I studied Java at university, and did c# at work.
You will find the Sun Java API (Javadocs) to be very informative and will help you dearly. You can find it here. This website should be the first to consult if you need a query, as it is brief, and up-to-date - similar to the MSDN Library for c#.
Also, Java has a strong community who will be willing to help # the forums.
Finally, I think its best to learn Java through practice and experimentation over theory. You will need a good IDE to start you off and there are plenty to choose from. Eclipse and Netbeans are notable Visual Studio contenders, but personally I prefer JCreator(albeit the version with intellisense is not free). It maybe text based, but you have greater control IMO.
If you are going to create GUI applications, then you should learn about swing. Again, the guys at sun provide excellent tutorials on the matter.
There are also books:
Java in a nutshell is a nice book. Click for google preview.
Java: the complete reference By Herbert Schildt is one I would highly recommend. Google Preview.
I'd recommend these books:
Effective Java (Joshua Bloch)
Core J2EE Patterns (Deepak Alur; John Crupi; Dan Malks) - sort of out of date, but still useful for understanding the history of J2EE. A lot of this is still applicable.
Concurrent Programming in Java (Doug Lea) - good guide to Java threading
Here's a more comprehensive list:
http://www.javalobby.org/articles/5books/full.jsp
It shouldn't be a difficult switch. Java is pretty much a subset of C# (Operationally) since C# was a Java clone that has mutated since it was split. (Everyone here remember the fiasco when MS tried to embrace java by modifying it so it would only work with windows, was sued by Sun and then made J++ and C# instead?)
The biggest difference will probably be the libraries, but if you are proficient at C#, then you shouldn't need to do anything more than study the Javadocs to pick up the new libraries.
EE might be a bit of a jump, but that's a whole 'nuther world.
For me, the nicest thing about Java is the minimal syntax. There are very few surprises or tricky parts to remember (Well, Generics have a kind of tricky syntax to implement, but using them is pretty straight-forward). If you agree with this or not--it does tend to make the learning curve a bit more shallow.
I started in Java and went to C#.
I will be honest with you; going back to Java won't be so easy, depending on how you started. It's going to change your world a bit. J2EE is quite different from ASP.NET, even though it looks a bit the same. Forget lots of things you used to hold dear, like == of strings, and switch on strings, and properties, and other such nicities. Oh, and prepare to be welcomed by checked exceptions.
Don't get me wrong, I love Java, and it's a great language, but you'll need be wary of the differences.
I would say a fun way to learn would be to write a program simultaneously in Java and C#, and see how you would do each thing, and note the differences.
I think you may find books hard to read, as they'll cover the basics, which will be boring for you, so you may skip critical things.
Learn by doing :) That is my approach.

What's a quick way to familiarize myself with C#, .NET framework, etc?

I just graduated college and will be starting working in about a month and I was asked to familiarize myself with C++, C#, .NET framework for NT Services and web services.
I'd appreciate recommendations on how to familiarize myself with these topics (books? internet links?) in a short time span. I don't expect to be an expert on it in a month but I don't want to be clueless either. I already know C++ and I consider myself to be fairly proficient in it and I know the basics of C# even though I haven't used it all that much. For C# I do own a book called O'Reilley Programming C#.
Thanks!
I would start by pulling down Microsoft's Visual Studio Express products. Your O'Reilly book is a perfectly good book to start with.
Start reading blogs and listening to podcasts, to begin to familiarize yourself with all of the technologies out there that surround c#. You will be very excited about what you can learn. Here are some of the better ones:
http://www.hanselminutes.com/
http://www.dotnetrocks.com/
http://channel9.msdn.com/
http://weblogs.asp.net/scottgu/
http://weblogs.asp.net/
In addition, the MSDN library is an invaluable resource. You can almost always find what you need there. This is where the reference for the entire .NET framework lives.
http://msdn.microsoft.com/en-us/library/default.aspx
Happy hunting!
Nothing beats actually using the language. As much as some of the information sources already quoted would be very useful to check out, I'd say make sure that you at least try and write some concrete C#.
The best place to start might be a non-trivial-but-not-too-large application that you have already written in something you know, and try to convert it to C#... even better if you can get somebody proficient in C# to peer-review your results to make suggestions where you could make better use of the language-specific features that may be new to you.
Fundamentally, if you just read books and watch videos, you may feel like you actually know it, but it is nothing like doing it yourself (as my Uni maths classes taught me... a good teacher can make the impossible look trivial on a blackboard).
That is a huge surface area. Pro C# 2008 and the .NET 3.5 Platform by Andrew Troelsen is a good place to start.
These are good podcasts that will give you an overview:
.NET Rocks
dnrTV
Herding Code
Microsoft Labs and Webcasts
Here's a good SO thread with lots of resources. I recommend you check out MSDN Virtual Labs. They have lots of great training that let's you get your hands on the technology, in particular, check out the C# ones.
I was in the same situation in late November 2008.
If you are familiar with IDEs and another programming language, download Visual Studio Express and start playing with it. It's free :)
http://www.microsoft.com/express/
And I always recommend this webpage:
http://www.java2s.com/Tutorial/CSharp/CatalogCSharp.htm
You can select the relative topic you are interested on this stackoverflow site based on the tag name, and read through some posts, it will give you a good feeling what are common issues/challenges people face in day-to-day programming.
One way is listening to podcasts. We do one called Deep Fried Bytes that contains a variety of topics on any and everything.

Categories