Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# tuple

 var tupleList = new List<Tuple<int, string, string, string>>();
 tupleList.Add(Tuple.Create(1, "Sefat Anam", "Dhaka Bangladesh", "0.1245345"));
Comment

tuples in c#

//You can define tuples with an arbitrary large number of elements:
var t = 
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26);
Console.WriteLine(t.Item26);  // output: 26

//You can explicitly specify the names of tuple fields either in a 
//tuple initialization expression or in the definition of a tuple 
//type, as the following example shows:
var t = (Sum: 4.5, Count: 3);
Console.WriteLine($"Sum of {t.Count} elements is {t.Sum}.");

(double Sum, int Count) d = (4.5, 3);
Console.WriteLine($"Sum of {d.Count} elements is {d.Sum}.");
Comment

Tuples in C#

public class Program
    {
        static void Main(string[] args)
        {
           var test = new Tuple<int, int> ( 10,11);
            Console.WriteLine(test.Item1);
            Console.WriteLine(test.Item2);

            var hugeTuble = Tuple.Create(1,2,3,4,5,6,7,(1,2,3,4,5,6,7,8));
            Console.ReadLine();
        }
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c sharp while statement 
Csharp :: init stirng list c# 
Csharp :: date format full month name c# selenium 
Csharp :: six simple machines labeled 
Csharp :: check the request comes from which operating system used by user in asp net core 
Csharp :: as c# 
Csharp :: calculator using single readline c# 
Csharp :: crystal reports convert decimal to integer in formula 
Csharp :: Make a variable public without showing in the inspector 
Csharp :: using autofac with automapper .net 6 with dependency injection 
Csharp :: dotnet DB context register 
Csharp :: 2d look at unity 
Csharp :: c# hashset 
Csharp :: Maximum Sum of Non-Adjacent Elements 
Csharp :: c# mapper.map 
Csharp :: loop c# 
Csharp :: c# use enum in class 
Csharp :: unity 2d platformer movement script rigidbody 
Csharp :: @razor identify last foreach 
Csharp :: how to dynamically load value in startup file in c# 
Csharp :: how to do Employing defensive code in the UI to ensure that the current frame is the most top level window in c# 
Html :: html euro symbol 
Html :: p5 cdn 
Html :: flutter build web html renderer 
Html :: divi font awesome 
Html :: bootstrap a link disabled 
Html :: html head logo 
Html :: html text justify 
Html :: NavBar Bootstrap v4 Fix 
Html :: open the file upload dialogue box onclick the image 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =