我在 Visual Studio 中遇到此错误:
Error CS7003 Unexpected use of an unbound generic name MyProject C:\Users[myname]\documents\visual studio 2015\Projects....\Index.cshtml 1
有问题的文件就在这里(第 1 行错误是对模型声明的引用):
@model MyProject.Models.MyAccount.Details
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_PrimaryLayout.cshtml";
}
<!-- Page Content -->
<div class="container">
.... more page stuff follows from here
模型类如下:
namespace MyProject.Models.MyAccount
{
public class Details
{
public static Details Select(Company c)
{
Details model = new Details();
model.SomeProperty = "SomeValue";
return model;
}
public String SomeProperty { get; set; }
}
}
奇怪的是,清理并没有让它消失,重建让它留在那儿,我构建/调试得很好。
最佳答案
需要关闭 Visual Studio 并重新启动才能清除错误。随后的重建不会产生错误。
关于c# - cs7003 意外使用未绑定(bind)的通用名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34456200/