C# language feature:

  • Tuples

applies to

  • methods

benefit

  • Facilitates returning of more than one value from a method.

how to use

  • For a method that returns a tuple, specify the return value types/identifier of a method delimited by , enclosed in ()

important note

  • To use tuples, add NuGet package System.ValueTuple to your project.

example:

        (string firstname, string lastname) GetPersonsName()
        {
            return (firstname: "Jeff", lastname: "Doe");
        }