C# Language Tuple solution


Example

You can return an instance of Tuple class from your function with two template parameters as Tuple<string, MyClass>:

public Tuple<string, MyClass> FunctionWith2ReturnValues ()
{
    return Tuple.Create("abc", new MyClass());
}

And read the values like below:

Console.WriteLine(x.Item1);
Console.WriteLine(x.Item2);