The call is ambiguous between the following methods: Identical.NameSpace.InitializeComponent() and Identical.NameSpace.InitializeComponent()

前端 未结 12 1604
野趣味
野趣味 2021-01-17 12:09

Ok, I suspect this might be a Visual Studio thing, but there must be some reason for this. I created from the list of default items a ListBox (Right Click on project, or fol

12条回答
  •  花落未央
    2021-01-17 12:24

    I have just had and resolved this exact thing..

    It happened at some point during or after I duplicated a form, in a WinForms program, then renamed it to blah_Copy.

    The main cs file and the designer cs file, are both partial classes. So if a method is defined in both and it has the same name and parameters (or same name and same no paramters) , / same signature then it will clash.

    In my case they both, both Initialize() { .. } definitions, had identical bodies so I easily just removed one.

    Also let's say the method is Initialize() (it was in my case). If you go to call itself, then hit F12 it will go to one of((or perhaps even at least one), of the definitions.

提交回复
热议问题