是否有可能解构一个未从方法返回的元组,但是是一个out参数?我不确定我是正确表达自己还是使用正确的术语,所以这里有一些例子:
void OutMethod(out (int aNumber, string someText) output)
=> output = (15, "yo");
void Usage()
{
{
// Works, of course.
OutMethod(out var tuple);
// But *slightly* aesthetically unappealing to use.
var usage = $"{tuple.someText}: {tuple.aNumber}";
}
{
// Would be awesome, but doesn't work.
OutFunction(out var(number, text));
}
{
// Would be awesome too, but doesn't work.
OutFunction(out (var number, var text));
}
{
// This doesn't work either.
OutFunction((out var number, out var text));
}
{
// Not …Run Code Online (Sandbox Code Playgroud)