开发者

Conflict warning after rename the form

开发者 https://www.devze.com 2023-03-24 04:48 出处:网络
In my first project, I encountered this warning many times. After reading the warning description, I don\'t know exactl开发者_运维知识库y what it is and how to fix it. I think it occurs when I change

In my first project, I encountered this warning many times. After reading the warning description, I don't know exactl开发者_运维知识库y what it is and how to fix it. I think it occurs when I change the name of winform(.cs file). Please let me know what is the cause of this warning and how to fix it? Thanks for your help.

Warning 1 The type 'Patience_Management.med' in 'C:\Users\TNhan\documents\visual studio 2010\Projects\Patience_Management\Patience_Management\Class1.cs' conflicts with the imported type 'Patience_Management.med' in 'c:\Users\TNhan\Documents\Visual Studio 2010\Projects\Patience_Management\Patience_Management\bin\Debug\Patience_Management.exe'. Using the type defined in 'C:\Users\TNhan\documents\visual studio 2010\Projects\Patience_Management\Patience_Management\Class1.cs'. C:\Users\TNhan\documents\visual studio 2010\Projects\Patience_Management\Patience_Management\kham.cs 17 9 Patience_Management

Maybe this image helps. The warning message appear at the green underline. http://www.freeimagehosting.net/newuploads/a58e0.png


Looks like you have two types with the same name. Rename one of them, clean the solution, and rebuild.


I'm not 100% sure this will fix the problem, but you should not use the same name for an object instance as the name of the object itself. In your screenshot, you're using:

addPatience addPatience = new addPatience(TextBox1.Text);

as well as

kham kham = new kham // rest of line ommitted

Without trying it myself, I'm not sure that would even compile, and if it did you might have run-time issues. At the very least, it would be confusing to read for any developer that would have to maintain your code.

Remember, C# is case-sensitive.

0

精彩评论

暂无评论...
验证码 换一张
取 消