Ash Ash - 3 months ago 9
C# Question

How can I return multiple values from a function in C#?

I read the C++ version of this question but didn't really understand it.

Can someone please explain clearly if it can be done and how?

Answer

Use .NET 4.0+'s Tuple:

For Example:

public Tuple<int, int> GetMultipleValue()
{
     return Tuple.Create(1,2);
}