我得到在VS2008以下設計錯誤:'Data.TimeLineChartedDay []'類型的對象無法轉換爲類型'Data.TimeLineChartedDay []'?
Object of type 'Data.TimeLineChartedDay[]' cannot be
converted to type 'Data.TimeLineChartedDay[]'.
???
public class TimeLineDisplay
{
private List<TimeLineChartedDay> chartedDays = new List<TimeLineChartedDay>();
public List<TimeLineChartedDay> ChartedDays
{
get { return chartedDays; }
set { chartedDays = value; }
}
}
[Serializable]
public class TimeLineChartedDay
{
private DateTime date;
private int chartValue;
public DateTime Date
{
get { return date; }
set { date = value; }
}
public int ChartValue
{
get { return chartValue; }
set { chartValue = value; }
}
public TimeLineChartedDay()
{
}
}
VS STACK:
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency)
at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck)
at System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo fi, Object target, Object value)
at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)
at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj, MemberInfo member, Int32[] arrayIndex)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at System.Resources.ResXDataNode.GenerateObjectFromDataNodeInfo(DataNodeInfo dataNodeInfo, ITypeResolutionService typeResolver)
at System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver)
at System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData)
at System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader)
在此之前的錯誤以下發生: 我添加了一個自寫控制。 VS崩潰與以下消息:「類TimeLineChartedDay未標記爲可序列化」。我發現這很奇怪,因爲它是寫在另一臺機器上的,它並沒有抱怨'Serializable'屬性。我將這個屬性添加到了課堂上,並且偶然發現了前面提到的錯誤。
爲什麼你的課程在ResX文件中? – SLaks 2010-12-15 16:02:39
???我的課程不在resX文件中.. ??,只是一個標準的.cs文件。 – 2010-12-15 16:09:33
但它被序列化爲一個.ResX。爲什麼? – SLaks 2010-12-15 16:23:25