Jump to content

Check out our Community Blogs

* * * * * 1 votes

Learning a new language: C#

Posted by WingedPanther73, 18 June 2011 · 1350 views

Last Tuesday, I decided it was time for me to finally learn C#. I feel pretty comfortable with C, C++, Delphi, Lazarus, VBScript, JavaScript, and ColdFusion. I'm also familiar enough with Java, Lisp, and a smattering of other languages to feel pretty confident that I can do this.

As a result, I picked up C# 4.0 Pocket Reference and started reading. I got about half-way through it when my first day off hit this morning. Having already installed Visual Studio Express, I started coding. Twelve hours later, I have a basic project management utility that can save/open files in XML format, stores tasks and subtasks in a TreeView, with the ability to create/delete nodes, promote them, demote them, and generally rearrange them as desired.

It's not fancy, but it works, and is pretty error proofed (except loading badly formatted files).

Things I discovered during the process:

  • The Visual Studio editor is fantastic. The code-insite facilities make it very easy to find the desired methods, avoid typos, and understand what the methods/properties do. In addition, you get compiler errors appearing/disappearing as you type, which makes it very easy to detect and correct mistakes in your code as you make them.
  • Once you are fairly strong in a few languages, it is really rewording to dive into a new language and find success. I was able to write a non-trivial program, complete with buttons, menus, and various GUI elements as my first C# program. I probably learned far more than I would have if I had just started knocking out the usual "Hello World" apps, and escalating up. In addition, it was quite rewording to have something that's actually useful (though it could use a few dozen more features).
  • XML is a really handy file format. You can easily test whether your save method is valid by opening the file in IE (my initial save failed). Parsing XML while reading is equally easy.
  • I've been plowing through Java: The Complete Reference, and while it's a fantastic book, I've been making the mistake of not actually coding anything. By contrast, the C# Pocket Reference let me get a quick summary of the language and rely on the Web and IDE to cover the gaps.
If you're pretty strong in one or more languages, writing non-trivial programs in it, you can start using new languages that use the same programming paradigms pretty quickly. It's a nice feeling.

On a side note, I think C# does a nice job of picking the best items from Java, without some of the dumb mistakes. Sort of 95% Java, 5% C++.

  • 0

I really like C# as well, (though Java is what we use at work...) and I've always joked that C# is "C++ with all the problems fixed." I love the similarity to Java, with heavy focus on proper Object Oriented styles. Both Java and C# are exceptional languages.
    • 0
I've been eyeballing it for some time, I do prefer the compiling over the packaging of Java applications, and of course enjoy the sight of those sugars (i.e. reserved get() and set() accessors for each function in a class, the bredth of libraries and interfaces within) however I just cannot dare to learn a language I cannot use fully unless on another platform.
    • 0
MonoDevelop will let you use C# on other platforms. The big limitation is you're effectively using .NET 2.0 instead of .NET 4.0. Still, the language is a cross-platform ECMA standard, it's just the wonderful libraries that are a bit messier.
    • 0
C# will be my next language of choice to learn, I've just finished two papers on C++ and a paper on Java so will be interesting to see how C# relates.
    • 0
I still have a soft spot in my heart for C++. One thing C# did right was allow operator overloading. I've yet to figure out why the Java people think that isn't important.
    • 0
I've been programming in JAVA for 2 years at university. When I recently started learning C# I found it very easy and I learned a lot in first few hours. I totally agree with Winged when he said "If you're pretty strong in one or more languages, writing non-trivial programs in it, you can start using new languages that use the same programming paradigms pretty quickly."
    • 0
I've been coding since last 5 years and what i found is C# with C++ is able to fill all kinds of needs related to System as well as Application programming.
    • 0
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download