我已經從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