0

このテキストの下にあるコードを修正するにはどうすればよいですか?

//puncts = puncts ?? new List<Vector2>() { new Vector2(position.X, position.Y) };

if (Vector2.Distance(position, puncts[indexpunkt] = puncts[indexpunkt]  ??  new Vector2(position.X, position.Y)   ) < 1)
                indexpunkt++;

エラー:

Error   1   Operator '??' cannot be applied to operands of type 'Microsoft.Xna.Framework.Vector2' and 'Microsoft.Xna.Framework.Vector2'

null の場合は新しいパンクトを作成し、そのリストに最初の要素を追加します。演算子を使用できますか?また、ステートメントで演算子を使用するには??どうすればよいですか? if

4

1 に答える 1

3

Vector2は でStructあり、null にすることはできないため、合体演算子は適用されません。

于 2012-01-12T18:02:57.457 に答える