Per this you may have something like this wherein (string, string) is a ValueTuple of string, string.
public (string, string) LookupName(long id)
{
return ("John", "Doe");
}
The input variable for id obviously does nothing, right? Anyhow, an example of an assignment from the same blog posting is:
ValueTuple<string, string> c = LookupName(0);
A ValueTuple is mutable! Also, an assignment, not to a tuple, but to two variables would look like so and this trick is referred to as deconstruction.
(string first, string last) = LookupName(0);
No comments:
Post a Comment