webinars blog downloads register login
 
Home Porting Products News Support About Us
Ice Tea Group Blog
Stay informed about the worldwide migration from
Team Developer to .NET. Don't get left behind.. again!

 

11
Frank Boettcher posted on May 11, 2010 04:36

Following the path to bring together their 2 main .NET programming languages,
Microsoft has introduced several language enhancements to C# in their just released version 4.0

Some of these features have been available for VB (.NET) for quite a while but now add comfort
and transparency also to C# based .NET code.

The first language enhancement is optional arguments:

You can now define method arguments that can be omitted when calling that method.
Additionally you can supply default values for such optional arguments.

Imagine a simple sample where you need a function to save a picture blob. You might want to specify the filetype and also an optional percent base scaling.




You can now call this method in the following ways:



Another very useful addition to C# 4.0 are named arguments.
Consider the following method that also includes optional arguments:



When calling that method you can directly assign arguments by their name:



Using named arguments can greatly improve readability and transparency especially with long lists of arguments. With optional arguments you can simplify your method declarations.

Visual Studio 2010 fully supports both named and optional arguments with the build in IntelliSense:

 

Now try to do this with Team Developer...

Actions: E-mail | Permalink |
 

Our Mission

We help developers stay competitive and
organizations preserve and increase the value of their
software investment.

©Ice Tea Group LLC. All Rights Reserved