我有以下類型:system.missingMethodException而:未找到方法: 'System.String .get_DayName()'
public class TimeBand
{
public string DayName { get; set; }
public int customerId { get; set; }
}
和我創建一個列表包含TimeBands:
var TimeBandList = new List<TimeBand>
{
new TimeBand()
{
DayName = DayOfWeek.Monday.ToString(),
customerId = 10
},
new TimeBand()
{
DayName = DayOfWeek.Tuesday.ToString(),
customerId = 11
}
.....
};
我使用以下方式將TimeBands加載到另一個列表中:
var timeBandRange = new List<TimeBand>();
timeBandRange = TimeBandList.Where
(p => p.customerId == newCustomerId
&& p.DayName == date.DayOfWeek.ToString()).ToList();
這工作正常,但在TimeBand I類決定從字符串所以代碼已經變成了這個樣子改變DAYNAME屬性DAYOFWEEK類型:
public class TimeBand
{
public DayOfWeek DayName { get; set; }
public int customerId { get; set; }
}
var TimeBandList = new List<TimeBand>
{
new TimeBand()
{
DayName = DayOfWeek.Monday,
customerId = 10
},
new TimeBand()
{
DayName = DayOfWeek.Tuesday,
customerId = 11
}
.....
};
DateTime date = IndDate;
var timeBandRange = new List<TimeBand>();
timeBandRange = TimeBandList.Where
(p => p.customerId == parameter.customerId
&& p.DayName == date.DayOfWeek).ToList();
這個新代碼現在失敗的TimeBandList.Where線並給出以下錯誤:System.MissingMethodException:未找到方法:'System.String TimeBand.get_DayName()'。
任何想法爲什麼?
謝謝
您是否嘗試過重建解決方案? – pascalhein
但在重建之前清理它。 – Steve
是的,我已經清理並重建,但仍然無法正常工作。 – 03Usr