0
内XNA 4空合并如何修复我的代码在此文本下?运营商?如果在语句
//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'
我希望创造新的puncts如果是零和第一个元素添加到其列表中。 我可以使用运营商??
以及我如何使用if
声明?
所以,我不能做任何if语句与我的vector2? – deadfish 2012-01-12 18:07:59
你可以用vector2在if语句中做很多事情,你不能检查它是否为null。这就像说我一样; if(i == null){...} – 2012-01-12 18:17:57
实际上它可能更像是说我int;如果(我==“你好”){...} – annonymously 2012-01-16 03:12:52