Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,907 questions

51,839 answers

573 users

How to return two values from a method in C#

1 Answer

0 votes
using System;

class Program
{
    static Tuple<int, int> m() { 
        int a = 34, b = 982; 

        return Tuple.Create(a, b);
    } 
    
    static void Main() {
        var result = m(); 
        
        Console.WriteLine("Item1 = " + result.Item1 + " Item2 = " + result.Item2);
    }
}



/*
run:

Item1 = 34 Item2 = 982

*/

 



answered Aug 8, 2019 by avibootz

Related questions

2 answers 191 views
3 answers 326 views
3 answers 285 views
1 answer 104 views
1 answer 126 views
126 views asked Jan 2, 2022 by avibootz
1 answer 120 views
120 views asked Dec 13, 2020 by avibootz
1 answer 130 views
130 views asked Dec 12, 2020 by avibootz
...