我在Mac OSX 10.8上使用Unity3D,Mono,C#。我正在嘗試使用.Net Enumerable.Zip。但複製粘貼MSDN示例給我一個cs0117錯誤。CS1061,CS0117:`System.Linq.Enumerable'不包含`Zip'的定義
最小不工作例如:
using UnityEngine;
using System.Collections;
using System.Linq;
public class Asteroids : MonoBehaviour {
void Start() {
int[] numbers = { 1, 2, 3, 4 };
string[] words = { "one", "two", "three" };
var numbersAndWords = numbers.Zip(words, (first, second) => first + " " + second);
}
}
錯誤消息:
錯誤CS1061:類型
int[]' does not contain a definition for
郵編 '和 沒有擴展方法Zip' of type
INT []' 可以找到(你 缺少使用指令或裝配參考?)
I試圖用 「Enumerable.Zip」 代替 「numbers.Zip」,然後我得到這個:
錯誤CS0117:
System.Linq.Enumerable' does not contain a definition for
郵編」
爲什麼這些happend?