http://www.codeproject.com/Articles/483055/XML-Serialization-and-Deserialization-Part-1
http://www.codeproject.com/Articles/487571/XML-Serialization-and-Deserialization-Part-2 I need all in C# form application
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
om prakashRank #5,816 · 285 reputationPosted Jul 21, 2013, 10:56 PM EDT
I have got error in this line...............
the code is
class file:
Using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class AddressDetails
{
public int HouseNo { get; set; }
public string StreetName { get; set; }
public string City { get; set; }
private string PoAddress { get; set; }
}
}
form:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using System.IO;
using System.Xml;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
{
AddressDetails details = new AddressDetails();
details.HouseNo = 4;
details.StreetName = "Rohini";
details.City = "Delhi";
Serialize(details);
}
}
static public void Serialize(AddressDetails details)
{
XmlSerializer serializer = new XmlSerializer(typeof(AddressDetails));
using (TextWriter writer = new StreamWriter(@"D:\Xml.xml"))
{
serializer.Serialize(writer, details);
}
}
}
}
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 21, 2013, 11:04 PM EDT
What error message your getting? Your code seems to be correct.
Regards,
Iftikar
om prakashRank #5,816 · 285 reputationPosted Jul 21, 2013, 11:11 PM EDT
om prakashRank #5,816 · 285 reputationPosted Jul 21, 2013, 11:11 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 21, 2013, 11:20 PM EDT
public class AddressDetails
Regards,
Iftikar
om prakashRank #5,816 · 285 reputationPosted Jul 22, 2013, 12:15 AM EDT
thnx I got output.. but I want to do deserialize method how can I do......I want to complete my tasks
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 22, 2013, 12:36 AM EDT
Regards,
Iftikar
om prakashRank #5,816 · 285 reputationPosted Jul 22, 2013, 12:40 AM EDT
om prakashRank #5,816 · 285 reputationPosted Jul 22, 2013, 12:41 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 22, 2013, 12:50 AM EDT
Regards,
Iftikar