は私がC#でタプルとアンパックアサインをサポートしていますか? Pythonで
def myMethod():
#some work to find the row and col
return (row, col)
row, col = myMethod()
mylist[row][col] # do work on this element
を書くことができます。しかし、C#で、私は自分自身がPython的な方法は、obivously非常にきれいです
int[] MyMethod()
{
// some work to find row and col
return new int[] { row, col }
}
int[] coords = MyMethod();
mylist[coords[0]][coords[1]] //do work on this element
を書き出す見つけます。 C#でこれを行う方法はありますか?
私はたぶんそのためのパラメータを使用しています。 –
@MikeChristensen:フレームワーク設計ガイドラインでは、避けることができる場合はパラメータに対して推奨しています。 – dtb
@MikeChristensen私はパラメータについて考えましたが、何らかの理由で汚い気分にさせてしまいます。 –