Search code examples
c#visual-studioauto-generate

VS auto-generated class error: Type already contains definition


I have the following class generated with Visual Studio's "Paste JSON as classes":

namespace MTGCollectionTracker
{

    public class ScryfallCardSource
    {
        //long chunk of code
        public string name { get; set; }
        public string lang { get; set; }
        public string released_at { get; set; }
        public string uri { get; set; }
        //another long chunk of code
    }
}

I get two "Type already contains definition" errors for set_name and set_uri. Why do I get them and how do I fix them?


Solution

    1. Why do you get them: You have two class members that have the same name

    2. How do you fix them: Rename one of them