C# program to add records to Tuple dynamically using the Tuple.Create static method

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 227
The below program will do so

List<Tuple<string, int, List<string>>> studentTupleStaticCreates = new List<Tuple<string, int, List<string>>>();

Enumerable
.Range(1, 3)
.ToList()
.ForEach
(
i => studentTupleStaticCreates.Add(Tuple.Create(
string.Concat("Student", i),
i + 16,
new List<string>()
{
string.Concat("Subject", i),
string.Concat("Subject", i+1),
string.Concat("Subject", i+2)
})
));

Comments or Responses

Login to post response