开发者

Why can't I have a folder named the same as a LINQ to SQL class

开发者 https://www.devze.com 2023-02-18 02:13 出处:网络
I\'m using the LINQ to SQL dbml with a table/class named Category. If I make a folder in the project named Category I can no longer refere开发者_如何转开发nce the table Category in my code. Why is thi

I'm using the LINQ to SQL dbml with a table/class named Category. If I make a folder in the project named Category I can no longer refere开发者_如何转开发nce the table Category in my code. Why is this.


Because adding the folder creates a namespace with it. ie. MyProject.Category will then refer the the linq to sql class as well as the namespace of your new folder.

This is probably bad practive to have a class and namespace called the same thing (especially if they are both in the same parent namespace)

0

精彩评论

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