Answers for "how to return multiple values from a method in c#"

C#
0

how to find the multiples of 3 c#

static void PrintNumbers()
{
    for (int i = 1; i <= 100; i++)
    {
        if (i % 3 == 0 && i % 5 == 0)
        {
            Console.WriteLine(i + " FizzBuzz");
        }
        else if ( i % 3 == 0)
        {
            Console.WriteLine(i + " Fizz");
        }
        else if (i % 5 == 0)
        {
            Console.WriteLine(i + " Buzz");
        }           
        else
        {
            Console.WriteLine(i);
        }
    }
}
Posted by: Guest on August-04-2020
8

c# return two variables of different types

(string, string, int) LookupName(long id) // tuple return type
{
    ... // retrieve first, middle and myNum from data storage
    return (first, middle, myNum); // tuple literal
}
Posted by: Guest on March-20-2020
0

c# method returns multiple values

public Tuple<int, int> GetMultipleValue()
{
     return Tuple.Create(1,2);
}
Posted by: Guest on September-30-2020

Code answers related to "how to return multiple values from a method in c#"

C# Answers by Framework

Browse Popular Code Answers by Language