Best Online Resource For Non-Resident Indians      SEARCH COOLNRI.COM
 HOME  FORUMS  PORTALS & REVIEWS  RECIPES  INDIAN RESTAURANTS  GROCERY  CLASSIFIEDS  MOVIES / TV  CHAT  NEWS  HOROSCOPE  PAINTINGS  CONTACT  LOGIN
Welcome Guest Search | Active Topics | Members | Log In | Register

What is tuple data type? Options
LalJose
Posted: Tuesday, May 24, 2011 2:07:29 PM
Rank: Administration
Groups: Administration

Joined: 4/5/2009
Posts: 7
The Tuple type in the C# programming language provides a unified type and syntax for creating an object with a variety of typed fields.
Tuple type is a class and therefore will be allocated in a separate location on the managed heap in memory. However, once you create the Tuple, you cannot change the values of its fields; this restriction makes the Tuple more like a struct. In the following example, we create a three-item tuple using the special constructor syntax and then read the Item1, Item2, and Item3 properties; we do not modify them.


// Create three-item tuple.
Tuple<int, string, bool> tuple = new Tuple<int, string, bool>(1, "cat", true);
// Access tuple properties.
if (tuple.Item1 == 1)
{
Console.WriteLine(tuple.Item1);
}
if (tuple.Item2 == "dog")
{
Console.WriteLine(tuple.Item2);
}
if (tuple.Item3)
{
Console.WriteLine(tuple.Item3);
}
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

COOLNRI.COM 2006-2012 |  TERMS OF USE |  PRIVACY STATEMENT |  SEARCH 
FinaMetric - Affordable Effective Project Management