הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
The contextual keyword 'var' may only appear within a local variable declaration.
- If the variable belongs at class scope, give it an explicit type. Otherwise move it inside the method where it will be used.
The following code generates CS0825 because var
is used on a class field:
// cs0825.cs
class Test
{
// Both of these declarations trigger CS0825
private var genreName;
private var bookTitles = new List<string>();
static int Main()
{
var totalBooks = 42; // var is OK here
return -1;
}
}
משוב של .NET
.NET הוא פרויקט קוד פתוח. בחר קישור כדי לספק משוב: