I've made a library and I've imported it adding a reference in the project and put using the namespace of my library, but when I'm trying to use a method it shows me an error.
"The type or namespace name 'UploadFiles' does not exist in the namespace 'MyGoogleUDS'(are you missing an assembly reference?)"
Project:
using MyGoogleUDS;
Run Code Online (Sandbox Code Playgroud)
error on this call:
MyGoogleUDS.UploadFiles("..\\" + asset.Name);
Run Code Online (Sandbox Code Playgroud)
My library:
namespace MyGoogleUDS
{
public class MyGoogleUDS
{
public static void UploadFiles(string path)
{
...
}
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
Your class name and namespace name is same, so you need to use namespace aliasing or you need to add namespace before class name
something like
MyGoogleUDS.MyGoogleUDS.UploadFiles("..\\" + asset.Name);
Run Code Online (Sandbox Code Playgroud)
Namespace aliasing,
using namespaceName = MyGoogleUDS;
namespaceName.MyGoogleUDS.UploadFiles("..\\" + asset.Name);
Run Code Online (Sandbox Code Playgroud)
As @JonSkeet suggested, I recommend you to update either namespace name or class name to avoid this issue.
| 归档时间: |
|
| 查看次数: |
57 次 |
| 最近记录: |