Skip to content
2010-07-20 / gerdk

Learning C# – Part 2

In Part 1 I discussed my reasons for this series and also introduced the book I’m using mainly to (re-) learn C#, Essential C# 4.0.

“Introducing C#”

Not much differences yet. Instead of main you use Main (but you can leave the String[] args param out and it still works in C#) and instead of String you use string and it is System.Console.WriteLine and not System.out.println.

It is nice though that composite formatting is right there in everything. In Java you would have to use MessageFormat.format or some other middle message stuff. But in C# you can write:

System.Console.WriteLine("There are {0} words in {1} lines. Remember: {0} words!", 10, 5);

Also there’s XML comments by using /** **/ and /// respectively. Nice generalisation of Javadoc comments.

There are some explainations around the CLI and how everything works, but that’s nothing new and not a 100% related to C# itself.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: