Sunday, February 21, 2021

Tuple in C#

Tuple Tuple has max limit up to 7 permeameter.

The Tuple<T> class was presented in .NET Framework 4.0. A tuple is an information structure that contains an arrangement of components of various information types. It very well may be utilized where you need to have an information construction to hold an article with properties, however you would prefer not to make a different sort for it. 

Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>
Example:
Tuple<int, string, string> per = 
                        new Tuple <int, string, string>(1, "Darshan", "Mitesh");
How to access tuple:
var person = Tuple.Create(1, "Darshan", "Jobs");
person.Item1; // returns 1
person.Item2; // returns "Darshan"
person.Item3; // returns "Jobs"

var numbers = Tuple.Create("One", 2, 3, "Four", 5, "Six", 7, 8);
numbers.Item1; // returns "One"
numbers.Item2; // returns 2
numbers.Item3; // returns 3
numbers.Item4; // returns "Four"
numbers.Item5; // returns 5
numbers.Item6; // returns "Six"
numbers.Item7; // returns 7
numbers.Rest; // returns (8)

Opps Part 1 : Abstraction

  Abstraction in C# is a fundamental concept of object-oriented programming (OOP) that allows developers t...