我的xml的C#类是什么?如何反序列化它

我的xml的C#类是什么?如何反序列化它,c#,sql,xml,C#,Sql,Xml,下面是我的源xml。我想为它编写c#类,然后反序列化它。所以我可以使用c#对象并将其保存到数据库中。 历史-:我在做json反序列化,效果很好,但在我的xml中遇到了问题“LastChangeId”节点可以是此xml的一部分,有时可能根本不存在,或者有时它有多个节点。这个问题影响了我的json解析。我必须切换回xml。任何帮助都是值得的 <FundingSource > <ClientAccountPaySourceId>16</ClientAccount

下面是我的源xml。我想为它编写c#类,然后反序列化它。所以我可以使用c#对象并将其保存到数据库中。 历史-:我在做json反序列化,效果很好,但在我的xml中遇到了问题“LastChangeId”节点可以是此xml的一部分,有时可能根本不存在,或者有时它有多个节点。这个问题影响了我的json解析。我必须切换回xml。任何帮助都是值得的

<FundingSource    >
  <ClientAccountPaySourceId>16</ClientAccountPaySourceId>
  <ClientAccountId>67</ClientAccountId>
  <ClientAccountName>Default Account</ClientAccountName>
  <PrimaryPartyId>62</PrimaryPartyId>
  <PrimaryRoleId>1290</PrimaryRoleId>
  <TenderTypeId>3</TenderTypeId>
  <TenderTypeName>Credit Card</TenderTypeName>
  <TenderInterfaceName>Credit Card</TenderInterfaceName>
  <CreditCareTypeName>Visa</CreditCareTypeName>
  <ChargeAccountMask>1111</ChargeAccountMask>
  <ExpirationDate>04/20</ExpirationDate>
  <BillingAccountName>Joe Montana</BillingAccountName>
  <BillingStreet>1235 Main St</BillingStreet>
  <BillingCity>Pleasanton</BillingCity>
  <BillingPostalCode>94588</BillingPostalCode>
  <BillingCountry>US</BillingCountry>
  <BillingTelephone>1231234567</BillingTelephone>
  <DisplayOrder>1</DisplayOrder>
  <UseForRecurring>true</UseForRecurring>
  <UseForNonRecurring>true</UseForNonRecurring>
  <IsActive>true</IsActive>
  <Invalid>false</Invalid>
  <ChargeAccountToken>VC84632147254611111111</ChargeAccountToken>
  <IsExternal>false</IsExternal>
  <LastChangeId   >
    <ClientAccountPaySourceId>16</ClientAccountPaySourceId>
    <TimeUtc>2016-02-02 01:04:16</TimeUtc>
    <TimeLocal>2016-02-01 17:04:16</TimeLocal>
    <UserName>Josh.Lyon</UserName>
    <PartyId>20</PartyId>
    <RoleId>1160</RoleId>
    <BusinessUnitCode>2</BusinessUnitCode>
    <EndpointKey>default</EndpointKey>
  </LastChangeId>
</FundingSource>

16
67
默认帐户
62
1290
3.
信用卡
信用卡
签证
1111
04/20
蒙塔纳
主街1235号
普莱森顿
94588
美国
1231234567
1.
真的
真的
真的
假的
VC8463214725461111111
假的
16
2016-02-02 01:04:16
2016-02-01 17:04:16
乔希,里昂
20
1160
2.
违约

有关更多信息,请参阅或相关问题的数量

可能重复的Care以解释否决票?虽然这是一个已经回答的简单问题,但我提供了所需的信息以及指向MSDN页面和相关问题的链接
public class FundingSource {
public int ClientAccountPaySource {get; set;}
public int ClientAccountId {get; set;}
public string ClientAccountName {get; set;}
...
}
//Use it like so:
System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(p.GetType());

x.Serialize(Console.Out, new FundingSource() { ClientAccountPaySource=1, ClientAccountId=100, ClientAccountName="Name"});