Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 自定义类反序列化程序始终显示错误“存在反映类型“”的错误”_C#_Xml_List_Serialization_Deserialization - Fatal编程技术网

C# 自定义类反序列化程序始终显示错误“存在反映类型“”的错误”

C# 自定义类反序列化程序始终显示错误“存在反映类型“”的错误”,c#,xml,list,serialization,deserialization,C#,Xml,List,Serialization,Deserialization,我在这里创建了一个班级报告。 现在我想反序列化这个类,并创建一个类ReadXMLfile。 但是总是会显示一个错误。有一个错误反映了CVSExport.WellReport类型 有人能帮我修一下吗?谢谢大家! namespace CVSExport { [Serializable] public class WellReport { private Well well = new Well(); public Well Well

我在这里创建了一个班级报告。 现在我想反序列化这个类,并创建一个类ReadXMLfile。 但是总是会显示一个错误。有一个错误反映了CVSExport.WellReport类型

有人能帮我修一下吗?谢谢大家!

namespace CVSExport
{
    [Serializable]
    public class WellReport
    {
        private Well well = new Well();
        public Well Well
        {
            get { return well; }
            set { value.CopyTo(well); }
        }
        private RunList runlist = new RunList();
        public RunList Runlist
        {
            get { return runlist; }
            set { value.CopyTo(runlist); }
        }
        public void CopyTo(WellReport c)
        {
            this.well.CopyTo(c.well);
            this.runlist.CopyTo(c.runlist);        
        }
    }

[Serializable]
public class Well
{
    private List<string> wellVarName = new List<string>();
    public List<string> WellVarName
    {
        get { return wellVarName; }
        set { wellVarName = value; }
    }
    private List<string> wellVarValue = new List<string>();
    public List<string> WellVarValue
    {
        get { return wellVarValue; }
        set { wellVarValue = value; }
    }
    private List<BagVarInfo> wellVarList = new List<BagVarInfo>();
    public List<BagVarInfo> WellVarList
    {
        get { return wellVarList; }
        set { wellVarList = value; }
    }
    public void CopyTo(Well c)
    {
        for (int i = 0; i < wellVarName.Count; i++)
        {
            c.wellVarName.Add(this.wellVarName[i]);
            c.wellVarValue.Add(this.wellVarValue[i]);
        }
    }
}

[Serializable]
public class RunList
{
    private List<string> runVarName = new List<string>();
    public List<string> RunVarName
    {
        get { return runVarName; }
        set { runVarName = value; }
    }
    private List<List<string>> runVarValue = new List<List<string>>();
    public List<List<string>> RunVarValue
    {
        get { return runVarValue; }
        set { runVarValue = value; }
    }
    private List<BagVarInfo> runVarList = new List<BagVarInfo>();
    public List<BagVarInfo> RunVarList
    {
        get { return runVarList; }
        set { runVarList = value; }
    }
    public void CopyTo(RunList c)
    {
        for (int i = 0; i < runVarName.Count; i++)
        {
            c.runVarName.Add(this.runVarName[i]);
            c.runVarValue.Add(this.runVarValue[i]);
        }
    }
    //public List<string> MaxActivityRunVarName = new List<string>();
    //public List<string> MaxActivityRunVarList = new List<>
}
public class ReadXMLfile
{
    public static WellReport deserializeXML()
    {
        XmlSerializer deserializer = new XmlSerializer(typeof(WellReport));
        TextReader textreader = new StreamReader(@"D:\XXXXXX\Well1.xml");
        WellReport wellreport = new WellReport();
        wellreport = (WellReport)deserializer.Deserialize(textreader);
        textreader.Close();

        return wellreport;
    }

}

是否存在InnerException值?您的代码不完整。你能显示BagVariInfo类的代码吗。