Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
An anonymous type cannot have multiple properties with the same name.
An anonymous type, just like any type, cannot have two properties that have the same name.
To correct this error
- Give each property in the type a unique name.
Example
The following example generates CS0833:
// cs0833.cs
using System;
public class C
{
public static int Main()
{
var c = new { p1 = 1, p1 = 2 }; // CS0833
return 1;
}
}
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.