First create a class file say “Customer.cs” and removed all the code from it, removing the code is not necessary, if we want to create the class in some existing class even then we can use this technique, enough talked let’s create a class from our above XML or JSON.
- Copy one customer record i.e.
<customer> to </customer>
- Open the customer.cs file and put the cursor where you want to create the class
- From Menu click Edit => Paste Special => Paste XML as Classes or Paste JSON as Classes which you want
- Our class is created
<Customer>
<CustomerID>124</CustomerID>
<CompanyName>Hungry Coyote Import Store</CompanyName>
<ContactName>Yoshi Latimer</ContactName>
<Phone>(503) 555-6874</Phone>
</Customer>
{
"Customer": {
"CustomerID": "123",
"CompanyName": "Great Lakes Food Market",
"ContactName": "Howard Snyder",
- "Phone": "(503) 555-7555"
}
}
No comments:
Post a Comment