Bilješka
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati da se prijavite ili promijenite direktorije.
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati promijeniti direktorije.
Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
An anonymous type must be declared with a member assignment, simple name, or member access.
- Ensure that your declaration uses only member assignment, simple names, or member access expressions.
The following code generates CS0746 in the declaration of incorrect_1
and incorrect_2
. The following declarations show two of the correct ways to declare an anonymous type.
// cs0746.cs
public class C
{
public static int Main()
{
int i = 100;
string s = "Bottles of beer.";
var incorrect_1 = new { a.b = 1 }; // CS0746
var incorrect_2 = new {100, "Bottles of beer."}; // CS0746
var correct_1 = new { i, s }; //OK
var correct_2 = new {num = i, message = s}; // OK
return 1;
}
}
.NET povratne informacije
.NET je projekat otvorenog koda. Odaberite vezu za pružanje povratnih informacija: