編譯器錯誤 CS0211
更新:2007 年 11 月
錯誤訊息
無法取得所給運算式的位址
您可以取得欄位、區域變數及指標間接取值 (Indirection) 的位址,但是您無法取得像是兩個區域變數總和的位址。如需詳細資訊,請參閱 Unsafe 程式碼和指標 (C# 程式設計手冊)。
下列範例會產生 CS0211:
// CS0211.cs
// compile with: /unsafe
public class MyClass
{
unsafe public void M()
{
int a = 0, b = 0;
int *i = &(a + b); // CS0211, the addition of two local variables
// try the following line instead
// int *i = &a;
}
public static void Main()
{
}
}