gpt4 book ai didi

c# - CS0426 - 类型名称 { } 在类型 { } 中不存在

转载 作者:太空狗 更新时间:2023-10-30 00:18:15 43 4
gpt4 key购买 nike

今天我在做我的项目,突然出现以下错误:

CS0426 The type name 'CustomerView' does not exist in the type 'PetrolStation'

我不知道这里发生了什么:

My Solution in VisualStudio

我认为上面显示的图像非常不言自明。您可能会注意到,同样的错误也会发生在代码块的更下方,并出现以下错误:

CS0426 The type name 'Views' does not exist in the type 'PetrolStation'

这里又出现同样的错误:

My Solution in VisualStudio

这引发了以下错误:

CS0426 The type name 'App' does not exist in the type 'PetrolStation'

有人知道这是怎么回事吗?

谢谢

最佳答案

如果您的类是在 PetrolStation 命名空间中定义的,那么在您尝试访问此类时不应指定此命名空间。删除类名前的 PetrolStation 命名空间:

App app = new App(); //and in other places without PetrolStation

如果您创建了与命名空间同名的类,您应该指定全名:

PetrolStation.PetrolStation.App app = new PetrolStation.PetrolStation.App(); //and in other places with one more PetrolStation

这似乎是您代码中的第一个案例。

关于c# - CS0426 - 类型名称 { } 在类型 { } 中不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40632034/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com