'namespace' but is used like a 'type'

前端 未结 7 1654
孤独总比滥情好
孤独总比滥情好 2020-11-27 04:35

This is my program the class uses it is called Time2 I have the reference added to TimeTest I keep getting the Error \'Time2\' is a \'namespace\' but is used like a \'type\'

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 05:32

    All the answers indicate the cause, but sometimes the bigger problem is identifying all the places that define an improper namespace. With tools like Resharper that automatically adjust the namespace using the folder structure, it is rather easy to encounter this issue.

    You can get all the lines that create the issue by searching in project / solution using the following regex:

    namespace .+\.TheNameUsedAsBothNamespaceAndType
    

提交回复
热议问题