Not
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Invalid initializer member declarator.
An object initializer is used to assign values to properties or fields. Any expression which is not an assignment to a property or field is a compile-time error.
To correct this error
- Ensure that all expressions in the initializer are assignments to properties or fields of the type. In the following example, the second expression is an error because the value 1 is not assigned to any property or field of List<int>.
Example
The following code generates CS0747:
// cs0747.cs
using System.Collections.Generic;
public class C
{
public static int Main()
{
var t = new List<int> { Capacity = 2, 1 }; // CS0747
return 1;
}
}