Follow in Twitter & Facebook

Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools

Monday, October 15, 2012

Tuple in C#.Net 4.0

In this article we will discuss about Tuple in C#.Net. You can also check out some articles on, Arraylist, Ado.Net etc.

- There are some new features in .Net 4, one of these is Tuple.

- Tuple actually a concept of F#, But in .Net 4.0 microsoft introduced Tuples to .Net.

- Arrays combine objects of the same type; tuples can combine objects of different types.

- .NET 4 defines eight generic Tuple classes and one static Tuple class.

- Tuple can be instantiated by Tuple constructor or the static Tuple.Create() method.

- Tuple.Create method has 8 overloads.

Here is an example that is provided in msdn:
var population = new Tuple<string, int, int, int, int, int, int>(
                           "New York", 7891957, 7781984,
                           7894862, 7071639, 7322564, 8008278);


Tuple<int, string> tuple = new Tuple<int, string>(1, "SharePointDotNet");

0 on: "Tuple in C#.Net 4.0"