Equivalent of Bloch's Effective Java for C# - c#

I've jumped into the C# bandwagon and was wondering if there's an equivalent of Joshua Bloch's Effective Java for the C# world.
I've already being able to apply some Java knowledge to C# given their similarity but I'm interested in knowledge to make the most effective use of C# specific features. For example, Generics are not implemented equally in Java and C#, so it's not clear to me if the Java Generic "techniques" will work in C# as well.
I'm mostly interested in C# 3.0. That is (of course) unless you guys think I would benefit for looking into versions 1 and 2 features.

Jon Skeet's C# In Depth is a favorite among StackOverflow users.
(source: askjonskeet.com)

There are two books Effective C# and More Effective C# by Bill Wagner that are similar to Effective Java.

Since you want something in the same line of Effective Java the following two books are very similar:
Effective C#
http://img253.imageshack.us/img253/8619/0321245660aa6.jpg
More Effective C#
http://images.amazon.com/images/P/0321485890.MZZZZZZZ.jpg

I found CLR Via C#, by Jeffery Richter, to be very good. It discusses the CLR and framework in some depth and gives you a greater understanding of how to use various feature along with potential pitfalls.

I think Framework Design Guidelines is the closest. While I don't think it's comparable to Effective Java in terms of depth, I haven't read found any better book in the same category.
C# in Depth is great, but it focuses more on the language than design issues in .NET. Therefore, I wouldn't put it in the same category with Effective Java.

How about Effective C#?

It's amazing to see how many people get to write books in the same vein as Scott Meyers' "Effective C++" and "More Effective C++". Here's an algorithm for becoming a published author:
Learn new language X.
Publish "Effective X" and "More Effective X".
Bank tsunami of currency that rolls in.
"Effective Haskell", anyone?
I don't mean this to denigrate anyone who does this. It's more of an homage to Scott Meyers - as good a computer scientist and writer as there is.

It is worth noting that a second edition of Bill Wagner's Effective C# was published recently (18th March 2010 in the UK). This second edition updates it to cover C# 4.0.
Personally, I was wholly unimpressed by the original edition of Effective C#, However, having bought this second edition a few days ago, it appears much better. It is not plagued by the same level of misprints, repetition and, most importantly, it correlates better with what I perceive as best practise rather than just detailing a lot of arbitrary personal choices.
The fact that it is updated to cover C# 4.0 is also important!
Having said all that, these are only my early observations as I haven't read much of it yet!

Effective C# and More Effective C# by Bill Wagner. The second book deals with C# 2 and 3.
Either here and here on Amazon.com
or here and here on Amazon.co.uk
There's a new version of Effective C# (Amazon UK) that covers C# 4.0.
Beaten to it by Andy, but I was looking up the links.

Jon Skeet's C# In Depth is also worth mentioning.

Related

No parametized types in C#?

Reading the Bruce Eckel book "Thinking in C#", to relearn C#, since I haven'y used it for many years but am likely to be needing it again soon.
I was surprised by this statement:
"In C++, the keyword that implements
parameterized types is “template.”
.NET currently has no parameterized
types since it is possible for it to
get by—however awkwardly—using the
singly rooted hierarchy. However,
there is no doubt that parameterized
types will be implemented in a future
version of the .NET Framework."
I think I remember reading somewhere that C# has generics - which are similar to C++ templates?
Am I wrong, or is the Eckel book simply too outdated (if so, is it worth still reading or is there a more up to date book online?)
[Edit]
Eeek, I'm glad I checked in here first. Looks like I'll have to throw that book away (written in 2002 I believe). Can anyone recommend any downloadable book that has the same depth of Eckels 'Thinking in ...' series?
There are a lot of C# books out there, but most of them are far too basic, or do not cover enough material. I was happy to find Eckel's book, since he covers C# in usual thorough style (from an introduction to OOP [which I don't need], through WinForm and Threading) - Unfortunately, it looks like its too old (Damn you MS for changing C# specs more times than I've had hot dinners!)
Can anyone recommend a good downloadable C# book that has a similar width/depth coverage?
[Edit 2]
Just seen this book:
http://www.free-ebooks-download.org/free-ebook/dotnet/CSharp/beginning-visual-csharp-2010.php
I'd like the opinion of this book from any professional C# developers out there ...
It's probably describing C# 1.0, which didn't have generics.
I would recommend finding a newer book that covers LINQ (introduced in C# 3) and dynamic (C# 4).
I would definitely get the most recent book that's relevant to the version of the .NET framework you're programming for. I started with an old book which didn't even cover automatic properties. Now one year later, I'm changing all of the previous code because it's so bloated and verbose.
Anyhow, C# does have generics, which as far as I can tell are the equivalent of C++ templates.
Generics are in C# since .NET 2.0, which came with Visual Studio 2005. The book is older than 5 years, you definetly need to get rid of it! :)
As others have noted, your book is out of date, or rather describes an out-of-date version of the framework.
It's interesting to note that the first language specification for C# published to ECMA for standardization included generics as a part of the language. C# 1.0 and 1.1, in not including generics, were not full implementations of the C# language. 1.0 and 1.1 should have been numbered 0.1 and 0.2 or some such, but Microsoft doesn't number things like that, as risk adverse people avoid doing real work with beta products.

How do I tune up my C# Skills, when I have spent the last decade coding in VB?

I started my career coding in C/C++ on a vax system, but got into a few contracts where it was all VB and then became a specialist in VB, then to VB.net. Now I am aspiring to work for Microsoft and it seems that every job they post is in C/C++/C# and I can barely read C# code, it looks like the most convoluted mess to me and the inline syntax almost hurts my feelings.
I am looking for positive, non-flaming, helpful suggestions on how to pick up C# skills again. Books..Labs..etc? I have been coding simple projects using Silverlight and C# to try and work it out but it is extremely frustrating since there are very few examples that I can find that illustrate what each code set looks like. I've Googled but have yet to find anything helpful other than channel9 labs and working through some of the example code/projects from mix10.
I am not looking for a shortcut, but a good solid skills understanding. I swear it is easier to translate English to Latin than VB to C#.
I personally would start by converting a VB.NET project into C#, having done VB.NET it wouldn't be difficult once you got started as they both use the same underlying CLR.
Doing it this way step by step, looking up how to convert each bit you don't understand, you'll soon end up teaching yourself C# based on you're knowledge of VB.NET and you'll see they're really not that much different!
I find them very similar now I know them both, they just have a habit of doing things 'slightly' differently.
Also, have a look at this wiki page for a summary comparison of VB.NET and C#, and check out the examples at the bottom to see some basic syntax comparisons that will give you a starting point for converting VB.NET into C#.
Since VB.NET and C# are both first-class object-oriented .NET languages that compile down to the nearly the same CIL code, I find it fairly easy to switch between the two. Most of the learning curve in .NET comes from learning the myriad APIs; syntax doesn't take terribly long to pick up.
I'd recommend a good book that focuses on the language of C# (that is, not a framework such as Winforms, Silverlight, or WPF). A book that I really liked was Illustrated C# 2008 by Daniel Solis. It's great at exposing the C# language from end to end. (NOTE: Although it says "Illustrated" in the title, it's not filled with lots of pretty pictures. "Illustrated" simply means that the author uses lots of helpful diagrams to explain concepts).
Also, I spent a good deal of time solving math problems at http://www.projecteuler.net in order to learn C#. It helps to have real problems to solve to learn a language and Project Euler offers problems that are small enough that you can still focus on learning different aspects of the language.
It's odd that you are having this difficulty if you can still remember anything about C. I have a similar background but I don't find C# hard to read at all.
Are you getting confused by LINQ or lambdas / anonymous methods? EDIT you say it's LINQ: here are some links for LINQ.
The LINQ syntax is different in VB from C# and there's not much help out there for the VB syntax. The MSDN 101 VB LINQ samples are good, and I also liked the coverage in the book Programming VB 2008.
Lambdas are a way of writing methods inline that might be the "inline syntax" you are referring to? In which case, just read up on them and try them out: you could try them out in C# or VB.Net.
There were some useful articles on differences between C# and VB.Net in Visual Studio magazine back in Jan 2008.
What VB developers should know about C#
And for completeness, What C# developers should know about VB
You might also be interested in the question "what's allowed in VB that is prohibited in C# (or vice versa)"
Full disclosure: the bottom part of this answer is copied almost unchanged from this question on converting C# knowledge to VB.Net
Buy "Head first C#" and enjoy yourself coding. It is the best book (according to me and a few others) on the market learning C#.
Scott Hanselman posts a regular column of his blog called the "Weekly Source Code", which is made of source code -- generally C# --- which you can learn from by reading.
My first choice is that given by W69rdy: convert some project you've already done in VB to C#.
Second, I would skim the C# documentation, or an online source like that suggested by James, at least once a day looking for something you don't understand. Perhaps something as simple as a language keyword you don't recognize. Then write something that uses it: even something as simple as a small snippet.
If you are looking for a quick read and tutorial, this one will work. I agree with #TechNeilogy and #W69rdy that converting a program from VB.NET to C# will help with understanding the similiarities and differences between the languarges.
I converted a VB.NET Windows service to a C# Windows service and it helped greatly with trying to learn C#.
I was a VB .NET programmer as well. I found that using Jetbrain's Resharper Visual Studio plug-in really helped my learning curve. I was initially converting/optimizing a VB .NET project into C# and I found the coding assistance tools really helpful. Most of the time, I was just trying to find the C# equivalent so code completion usually put me in the right direction.
I've also recently been moving to C# from VB - I've found this converter invaluable as a learning tool when you don't know a bit of C# syntax but you can write it in VB.
You should start with some C# tutorials in internet to understand the how to work with c#, then read a book with maximum 300 pages.
After that you can start the converting from VB to C#. It is not difficult.
Good luck.
I use both vb.net and c# at work. Sometimes in the same project even. Honestly, when you switch back and forth, after the first couple misplaced or missing ; or Dim's, it's pretty easy to jump between the two. The rest of the stuff (class modifiers, event handlers, etc.) is only a quick google away.
The only way you are really going to make the step across, is to just make the step across and run with it!
Sure, check out a basic tutorial or read a guide on C# to learn the syntax basics, but then you need to find a reasonably simple, self-contained project to get stuck into. If you know some of the .NET framework (which you presumably do), then the jump won't actually be that great. Obviously, don't pick a vast, complex, mission-critical system to start with!
In fact, although my current project is my first c# project, I can't believe I didn't make the switch earlier. Apart from enjoying C#, I'm also finding it easier because I'm finding there are more good quality examples around.
I don't mean this patronisingly, but the answer is to simply start coding in C#!
There are plenty of books, resources, training CDs (check out AppDev.com for some great video based training) but nothing compares to just coding for real-life problems!
(And I agree with a previous comment about converting a recent project to C#.)
"That which we learn to do, we learn by doing" Aristotle

Which C# 4.0 Book would you purchase, and why? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm currently looking at purchasing a few C# 4.0 books, namely:
Essential C# 4.0 by Mark Michaelis or C# 4.0 Unleashed by Bart De Smet.
I am aware that both books are yet to be released, but would you consider purchasing either of these books, or would you recommend another?
Thanks for your time.
Clarification:
I'm not a .NET Ninja, but I do have 8+ years experience with the framework & related languages. So I'm generally looking for in-depth books. I also train/instruct the rest of my organisation generally 6 - 12 months after each .NET release. Each of the developers I train has the same or more .net experience than myself.
Once again thank you all for your time.
Update:
Thank you everyone for your responses. I've decided to purchase both books along with Visual C# 2010 Recipes: A Problem-Solution Approach, as suggested by Waleed Al Balooshi.
I was the technical editor for Mark's book. I quite enjoyed it, it is well written, and accurate.
An interesting thing about the difference between Mark's book and Jon's book (for which I was also the technical editor) is that both of them have accurate titles. "C# in Depth" really does go into quite a lot of depth; Jon doesn't shy away from the abstruse or theoretical, though of course he always has an eye on the practical. Mark's book really is more about cutting to what is essential to understand in order to get the job done. Both approaches are valid and reasonable.
Bart is a smart guy and I would imagine his book is quite good; not having read it, I cannot offer a personal opinion one way or the other.
I would recommend that you buy the MEAP (Early Access Edition) of Jon Skeet's C# in Depth 2nd edition, which is updated to include C# 4.0
In addition to this there is also:
C# 4.0 in a Nutshell: The Definitive Reference (Already Out)
Other than that I can't really say about the other books, because they aren't out yet, but I like the A Problem-Solution Series:
Visual C# 2010 Recipes: A Problem-Solution Approach (Not Out Yet)
I would wait till the books are out and you can read some reviews about them, till then I again highly recommend Jon Skeet's book.
In full disclosure, I am an editor with Addison-Wesley/Pearson. C# books are not one size fits all. It depends on your level of experience, as well as your programming background (are you a Java developer wanting to learn C# or are you trying C# programming for the first time?). We are publishing a lot for the 4.0 release, which may seem like over publishing to an outsider, but consider these differences: Sams Teach Yourself Visual C# 2010 is a quick get “up-and-running” tutorial for the very beginner. No programming experience needed. Bill Wagner's Effective C# books are a healthy dose of hard-earned wisdom, advice, and tips for the intermediate to experienced C# developer. C# 4.0 How to is a “just-what-you-need-to-know” title that focuses on general explanations and teaching “essentials” to the working, intermediate-level developer. Mark Michaelis' popular "Essential C#" is a “start-to-finish” guide focused ONLY on the C# language (2.0, 3.0, and 4.0) for the beginner to intermediate developer while C# Unleashed is the comprehensive “everything but the kitchen sink” reference guide focused on C# and .NET for the intermediate developer. Finally the Deitel's publish a lot of textbook C# for the academic community. I will also vouch for Jon Skeet's C# books. He is very knowledgeable and well regarded in the community. Whatever you decide, I would recommend taking a look at sample chapters that publishers release to see what approach/author best meets your needs.
I would wait for Jon Skeet to write one and buy it.
+1 for Bart de Smet. You can sample his writing by visiting his blog, which has been in my aggregator for years.
In the end, however, the most important thing is to find someone whose approach resonates with you.
Pro C# 2010 and the .NET 4.0 Platform
This is probably the only book you will need.
I would wait until after April and look at blogs and podcasts until then to be absolutely sure things don't change too much!
This book looks quite good for newcomers:
Introducing .NET 4.0: With Visual Studio 2010
http://www.amazon.co.uk/Introducing-NET-4-0-Visual-Studio/dp/143022455X/ref=sr_1_1?ie=UTF8&s=books&qid=1265798479&sr=8-1
I'll probably hold out till
Pro C# 2010 And The .NET 4.0 Platform 5th Edition (Andrew Troelsen)
http://www.amazon.co.uk/gp/product/1430225491/ref=s9_simi_gw_p14_t1?pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=center-1&pf_rd_r=1B44BHPWP93JTH087A55&pf_rd_t=101&pf_rd_p=467198433&pf_rd_i=468294
The devil you know is better than the devil you don't: Mark Michaelis has published several books, mostly on C#, while de Smet seems to have only this title to his name. I'd go with Michaelis.
It depends on what you are looking for? Do you want a beginners book or a more in-depth book? It also depends on the style of book you are looking for. Another one, also not released yet, is the upcoming Sams Teach Yourself Visual Studio 2010 in 24 Hours< (which is really focused on C# 4.0 rather than Visual Studio).
It depends on what you need from the book.
If you want to push C# to newcomers, you might want to try O'Reilly's Programming C# 4.0 or Beginning C# 4.0 from Wrox.
If you're looking for a language drill-down, then you've already got C# in Depth on order, but I would consider Bart de Smet's book as well as another c# stunt coder, given his blog.
If you're looking for more real-world applications, I'd highly recommend Bill Wagner's Effective C# which is being updated for C# 4.0. This is one of the books that sits on my desk almost all the time. I really like it.
I would prefer book of Microsoft publication (MOC) , BLACK BOOK and wrox publication book
If you're looking for suggestions for one particular good C# book, I would recommend a couple different books of your choice at the same time. You always get a good cross-section of knowledge that way because different authors use different analogies, have different angles on teaching, etc. It makes you wiser.
Additionally, supplement your book knowledge with materials and samples from the Internet like MSDN, CodeProject, etc. Some books have companion CDs.

Base Class Library

I am new to C#, C++ and .Net.
I am currently returning to programming from a stint in Networking and Cisco engineering. I used to program on IBM mainframes etc using Cobol, assembler, easytrieve, Rexx and clist etc so the command syntax is reasonably familiar to me as are programming standards and structures.
However I am having quite a bit of trouble getting to grips with the BCL and understanding the various components and what each is designed for and which is best to use in various situations, and in fact how some are actually used and coded.
I am often scratching my head wondering how the code came about from the descriptions I have found about the BCL components. Basically how to use them and code them seems to be a black art with no intuitive means at all.
So my question is, apart from the msdn library, which I am finding to be a bit over complicated for my current needs, is there any good reference book, site, pdf that can give me a reasonable description, usage notes etc of the most commonly used .NET components such as System.IO etc ?
I have read a few book on C# etc and have found a small program that does part of what I need to do in a project I have, requiring acces to devices via RS-232 ports, but when decoding the program I find myself wondering why the person used the components he did and how would I know which components I should use when I make the changes I need to and add in the extra code that I require and how do I actually use these components when I do find them ?
I do realise a lot of this will be down to plain old experience, but a helping hand in the right direction would really help a lot.
Many thanks, George.
C# 3.0 in a Nutshell is good for this, as is Accelerated C# 2008. I think I'd personally recommend Nutshell more.
Note that the next edition of Nutshell is being prepared - but I don't know what the timeframe is. (I'm sure there'll be a slew of books for .NET 4.0.)
(Note of bias: I'm a tech reviewer for C# 4.0 in a Nutshell, so I'm clearly not 100% impartial.)
I often use Google in preference to the standard Help, there are often better examples out there.

C# popularity industry-wide or is SO atypical? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I feel I'm a well rounded programmer, I'm comfortable in C# and java (several large projects with both) but I tend to use C++ for most applications when I have a choice. (and sometimes R,Python, or Perl as appropriate..)
But I am astounded to see the popularity of C# here on SO. There are 18500 C# topics, more than C, C++, and java combined. I've never felt C# as having such an impact in the companies I've worked with but the SO popularity of C# is undeniable.
My question:
Why is C# so popular on Stack Overflow? My question is not so much a SO question as a desire to understand C#'s current acceptance/growth compared to C++ and java.
Possible explanations for the popularity:
C# is truly that popular and accepted in industry, it's everywhere!
SO is not typical, it seems to have attracted a disproportionate number of C# users
C# has more questions/confusions that tend to need community help to solve
Microsoft (maybe on its forums?) encourages people to use SO for questions
The first explanation is likely the reason, but I just haven't felt that popularity in the real world!
What's your reason you discuss C# topics here?
I think the founders of SO are .Net gurus. Most of the people who follow their blogs found out about the site, and started coming here. The original user base was probably pretty .Net/C# focused.
I also think that C# is the preferred language in .Net with it's interop and ability to use old C and C++ code. Those familiar with C, C++, and Java can easily get a useful application built and working in C#, and be pretty certain it will run on any system with the proper .Net framework installed.
And, C# sounds cool.
I wrote about the popularity of C# on another thread, but to discuss why it's popular on SO, I'd say others have the right of it. C# is popular here because most of the people who first came to SO did so following Jeff Attwood's blog. That's certainly how I came here.
The thing is, SO really is language neutral, even if it's written in C#. Both Jeff and Joel have programmed in other languages and are hardly bigots when it comes to language; they just chose C# because it really is an amazing language to program in.
Comparing C# to Java and C++, the growth has been astounding. C# when it was first introduced was basically Java with a better GUI library (Win.Forms beats the ever-lovin' snot out of Swing any day, IMO, and WPF is heads-and-shoulders above both) and a few extra concepts, the biggest of which was delegates and properties as first-class citizens. Since then it's grown meteorically, constantly adding newer and better things. The entire concept of LINQ has drastically changed the way I approach iterations; couple that with WCF for contract-based inter-process/computer communications and WPF for a truly amazing way to build GUIs, and you've got a rock-solid language and library.
Hell, WCF alone makes .NET the correct enterprise/SOA choice.
By contrast, Java hasn't released a new version in, what, 5 years?
C# is innovating. Java is stagnating. C++ is... well let's call it "stable", shall we? The newest version, which is dubbed "C++0x" will soon need to be called "C++1x". The features that are planned require so many changes to the runtime that you're almost going to have Java or C# when you're done anyway so why bother?
Finally, to answer your last question, I come here to answer questions about any topic. I mostly prefer to deal with abstract problems rather than language-specific issues, but I'm always willing to help regardless of language. Just because I love C# doesn't mean it's all I know. :)
I think it's a combination of reasons 2 & 3. From what I've seen, C# is not as popular as Java, and it's probably not as popular as C++.
From where I live, most people use Java, followed by CPP, followed by C#.
Is atypical.
C# is very popular but StackOverFlow is by no means a reflect of the industry-wide.
Dup: Why is there such a large percentage of C# questions?
Related: Why does Ruby seem to have fewer projects than other programming languages?
I've mostly avoided C#, because (a) I've got a silly prejudice about that glandular freak of a program loader masquerading as an operating system — I just don't do Windows, and (b) because it's so much like Java that I have trouble keeping them apart in my head.
That said, there's a lot of C# being done, and if I weren't an old crank it'd probably be a good language.
The thing is that C++ is riding without training wheels. This makes it much better for some things — I helped build the AS/400 operating system in C++, bare metal up — but not as good for the sort of application programming most people do most of the time.
I guess that is partly due to people knowing of the site thru Jeff Atwood's blog, and Joel Spolsky's website.
Although their writings are not technology specific, it has a slant towards MS stack and hence the site is popular among developers working on MS suite of tools/languages.
Once the site becomes more popular and gets ranked high in google for questions on other tools, it will have more questions on those topic as well.
It really just depends if you plan on working with windows. If you like Linux or mac better then you probably want to use another language (although you could use Mono.NET). I just use C# because of 3 main reasons:
Easy to learn
Easy to use
Easy to deploy
But if you like a different language better then use it. Right now I'm learning C so that I can help contribute to some of my favourite open source linux apps.

Categories

Resources