Friday, June 1, 2012

Return multiple values from a single method in C#?


If you mean returning multiple values, you can either return a class/struct containing the values you want to return, or use the "out" keyword on your parameters, like so:
public void Foo(int input, out int output1, out string output2, out string errors) {
    // set out parameters inside function
}

No comments:

Post a Comment