Asp.net mvc不一致可访问性属性

Asp.net mvc不一致可访问性属性,asp.net,asp.net-mvc-4,Asp.net,Asp.net Mvc 4,我对这一切都不熟悉,但我找不到答案。我为我的无礼感到抱歉 using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace Myproject.Models { public class Product { public int ProductID {

我对这一切都不熟悉,但我找不到答案。我为我的无礼感到抱歉

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Myproject.Models
{
    public class Product
    {
        public int ProductID { get; set; }
        [Required]
        public string Name { get; set; }
        public string Weight { get; set; }
        public List<Options> **Options** { get; set; }
        public List<Variants> **Variants** { get; set; }
    }
}
我已经开始了有蓝色下划线的位

我还有另外两种型号:options.cs型号和variants.cs型号

问题是,我在列表后面的选项和变体文本中得到了这个错误消息。 我一直在遵循MVC 02 |开发ASP.NET MVC 4模型教程,在制作模型时,Chris使用公共列表会话{get;set;},但他没有得到任何蓝色下划线

我的问题是为什么我得到了不一致的可访问性属性

克里斯用的是2012年,我用的是2013年的visual Studio。这与此有关,但为什么?我该如何修复它

我在我的DbSet选项{get;set;}和我的变量DbSet上得到了相同的错误


谢谢你的帮助

在options.cs和variants.cs文件中,将您的类标记为public:

在公共类中,您不能公开非公共类型的公共属性,因为在这种情况下,其他外部程序集可以查看您的公共属性,但如果该类不是公共的,则该类型对它们来说是未知的

public class Options { ... } 
public class Variants { ... }