当前位置:网站首页>Import other custom namespaces in C#

Import other custom namespaces in C#

2022-08-10 13:19:00 HUAWEI CLOUD

How to import other custom namespaces in c#

First make sure you have imported the custom namespace you want to import.

As shown aboveinsert image description here

At this time, the compiler should report an error. At this time, you need to manually add references. The cs file does not add references by default. It just loads the namespace you want to import, but no references are added, so you need to manually add references yourself..Remember!
insert image description here
Then there will be a dialog box

insert image description here
Select the namespace you want to reference and click OK.

Note: Generally speaking, if there is no change in C#, the class name of the general project is Program by default. If you need to pay attention to the same class name when referencing, add a space name in front to distinguish it.At the same time, pay attention to the access rights of the referenced class. If it is a class with protection rights, there will be some problems when referencing. I have little knowledge, so I can only give a small suggestion to improve the access rights of the class.

原网站

版权声明
本文为[HUAWEI CLOUD]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208101232218004.html