Tuesday, January 17, 2017

Deconstruction in C# 7.0



 Deconstruction is a process of split a variables value into parts and store it on new variables. It is important when a variable stores multiple values such as tuple.
The method GetATuple returns a tuple with three values.

Example:
(string name, string city, int sal) GetATuple(int id)
{
String name =string.empty;
String city=string.emplty;
Int sal=0;
If (id ==1000)
{
name=”Sachin”;
city=”Kanpur”;
sal=2000;
}
return(name, city, sal)
}

No comments:

Post a Comment