Napomena
Pristup ovoj stranici zahteva autorizaciju. Možete pokušati da se prijavite ili da promenite direktorijume.
Pristup ovoj stranici zahteva autorizaciju. Možete pokušati da promenite direktorijume.
Implicitly typed locals cannot be const
Implicitly typed local variables are only necessary for storing anonymous types. In all other cases they are just a convenience. If the value of the variable never changes, just give it an explicit type. Attempting to use the readonly
modifier with an implicitly typed local will generate CS0106.
- If you require the variable to be constant or
readonly
, give it an explicit type.
The following code generates CS0822:
// cs0822.cs
class A
{
public static int Main()
{
const var x = 0; // CS0822.cs
return -1;
}
}
Povratne informacije za .NET
.NET je projekat otvorenog koda. Izaberite vezu da biste pružili povratne informacije: