我有以下功能無法隱式轉換類型
public Dictionary<DateTime, object> GetAttributeList(
EnumFactorType attributeType,
Thomson.Financial.Vestek.Util.DateRange dateRange)
{
DateTime startDate = dateRange.StartDate;
DateTime endDate = dateRange.EndDate;
return (
//Step 1: Iterate over the attribute list and filter the records by
// the supplied attribute type
from assetAttribute in AttributeCollection
where assetAttribute.AttributeType.Equals(attributeType)
//Step2:Assign the TimeSeriesData collection into a temporary variable
let timeSeriesList = assetAttribute.TimeSeriesData
//Step 3: Iterate over the TimeSeriesData list and filter the records by
// the supplied date
from timeSeries in timeSeriesList.ToList()
where timeSeries.Key >= startDate && timeSeries.Key <= endDate
//Finally build the needed collection
select timeSeries);
}
Error:Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<System.Collections.Generic.Dictionary<System.DateTime,object>>'
to 'System.Collections.Generic.Dictionary<System.DateTime,object>'.
An explicit conversion exists (are you missing a cast?)
使用C#3.0
謝謝你提供一個非無意義的答案。 +1 – leppie 2010-05-27 11:31:59