我已经从CodePlex下载并检查了Microsoft的MVC源代码。根据源代码中的类定义如下:我看不到System.Web.Mvc.SelectListItem类中的“Disabled”属性
namespace System.Web.Mvc
{
public class SelectListItem
{
/// <summary>
/// Gets or sets a value that indicates whether this <see cref="SelectListItem"/> is disabled.
/// </summary>
public bool Disabled { get; set; }
/// <summary>
/// Represents the optgroup HTML element this item is wrapped into.
/// In a select list, multiple groups with the same name are supported.
/// They are compared with reference equality.
/// </summary>
public SelectListGroup Group { get; set; }
public bool Selected { get; set; }
public string Text { get; set; }
public string Value { get; set; }
}
}
但是,当我在类的属性定义编写如下代码
List<System.Web.Mvc.SelectListItem> statuses = (from s in DataContext.OfferStatuses
select new System.Web.Mvc.SelectListItem
{
Value = s.Id.ToString(),
Text = s.Code,
}).ToList();
我无法看到“已禁用”属性。另外,当我迭代状态集合时,我仍然无法看到属性。
为什么我看不到一些公开定义的属性?
我看到的问题。现在这一切都有道理。非常感谢你提供的信息。尽管我已经在项目中检查了AssemblyInfo.cs,但似乎也应该检查CommonAssemblyInfo.cs。 – user3021830 2014-09-04 21:49:32