C# naming conflict: My class "Tag" conflicts with "object Control.Tag"

Viewed 68

I have a custom class called "Tag" inside my VS C# project. I try to access its static method inside a WinForm form, like this:

Tag.someMethod()

VisualStudio interprets "Tag" as "object Control.Tag {get; set;}". This seems to be silly, but I'm not sure if it should happen and how to resolve it. I prefer not to rename my class, I like this short name. Also I don't want to reference it using the namespace of my project, it is too long. Can anything be done to force VS to recognize "Tag" as my custom class?

1 Answers

You can use an alias for the namespace if it is big and then use it in the code.

using Project = PC.MyCompany.Project;
Project.Tag.someMethod();
Related