我是 c# 的新手,我正在努力研究如何从我已经序列化到一个类中的一些 xml 中获取一个值。
我使用 xsd 构建了这个类,正如我在堆栈上找到的一个线程中所解释的那样。
任何人都可以帮我获得 LoginState 的价值吗?
这是我调试时看到的...
这是我将其序列化为的类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace vCreate.Model
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class NewDataSet
{
private object[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Table", typeof(NewDataSetTable), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("Table1", typeof(NewDataSetTable1), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] Items
{
get
{
return this.itemsField;
}
set
{
this.itemsField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class NewDataSetTable
{
private string loginStateField;
private string loginMessageField;
private string authIDField;
private string userIDField;
private string companyIDField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string LoginState
{
get
{
return this.loginStateField;
}
set
{
this.loginStateField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string LoginMessage
{
get
{
return this.loginMessageField;
}
set
{
this.loginMessageField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string AuthID
{
get
{
return this.authIDField;
}
set
{
this.authIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string UserID
{
get
{
return this.userIDField;
}
set
{
this.userIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string CompanyID
{
get
{
return this.companyIDField;
}
set
{
this.companyIDField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class NewDataSetTable1
{
private string languageIDField;
private string languageDescriptionField;
private string langLargeImageField;
private string langThumbImageField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string LanguageID
{
get
{
return this.languageIDField;
}
set
{
this.languageIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string LanguageDescription
{
get
{
return this.languageDescriptionField;
}
set
{
this.languageDescriptionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string LangLargeImage
{
get
{
return this.langLargeImageField;
}
set
{
this.langLargeImageField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string LangThumbImage
{
get
{
return this.langThumbImageField;
}
set
{
this.langThumbImageField = value;
}
}
}
}