c# - 模型中的 MVC List<> 错误引用了另一个模型

标签 c# asp.net asp.net-mvc

List<Story> 中有错误:

the type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?) (CS0246) [project]

using System;
using project.Models;

namespace project.Models
{
    public class Genre
    {
        public int GenreId { get; set; }

        public string Name { get; set; }
        public List<Story> Stories { get; set; }
    }
}

最佳答案

您缺少 using 语句 using System.Collections.Generic;

关于c# - 模型中的 MVC List<> 错误引用了另一个模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58661304/

相关文章:

c# - 为什么 Windows 安装程序不删除服务?

c# - 服务器和客户端之间的双向通信

asp.net-mvc - ASP.NET 核心 MVC : setting expiration of identity cookie

asp.net-mvc - ASP.NET WEB API 将 DateTime 作为 URI 的一部分传递给 Controller

c# - 如何在 C# 中按行对锯齿状数组进行排序?

c# - WQL Like 语句和语法

c# - 如何确定是否正在使用 Microsoft.VisualStudio.Web.CodeGeneration.Design?

ASP.NET 控制与 MVC 的 Razor 引擎

c# - C# 中的性能和内存消耗

javascript - 将按钮的值传递给隐藏字段并将其保存到数据库