Cannot implicitly convert type ...
- by Newbie
I have the following function
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 new AssetAttribute()
{
TimeSeriesData = PopulateTimeSeriesData(timeSeries.Key, timeSeries.Value)
}).ToList<AssetAttribute>().Select(i => i.TimeSeriesData));
}
private Dictionary<DateTime, object> PopulateTimeSeriesData(DateTime dateTime, object value)
{
Dictionary<DateTime, object> timeSeriesData = new Dictionary<DateTime, object>();
timeSeriesData.Add(dateTime, value);
return timeSeriesData;
}
Error:Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.Dictionary'. An explicit conversion exists (are you missing a cast?)
Using C#3.0
Please help