Expected class delegate enum interface or struct
expected class delegate enum interface or struct
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Iftikar HussainPosted Jul 22, 2013, 6:08 AM
om prakashPosted Jul 22, 2013, 5:48 AM
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
using
System.Xml.Serialization;
using
System.IO;
using
System.Xml;
namespace
WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Serialization of object to XML form
AddressDetails details = new AddressDetails();
details.HouseNo = 4;
details.StreetName =
"Rohini";
details.City =
"Delhi";
Serialize(details);
MessageBox.Show("Completed");
}
private
void Serialize(AddressDetails details)
{
throw new NotImplementedException();
}
private void button2_Click(object sender, EventArgs e)
{
//Deserialization of XML to object form
XmlSerializer deserializer = new XmlSerializer(typeof(AddressDetails));
TextReader reader = new StreamReader(@"D:\Om\myXml.xml");
object obj = deserializer.Deserialize(reader);
AddressDetails XmlData = (AddressDetails)obj;
reader.Close();
string data = string.Empty;
data =
String.Format("House No :{0}", XmlData.HouseNo) + Environment.NewLine;
data = data +
String.Format("StreetName :{0}", XmlData.StreetName) + Environment.NewLine;
data = data +
String.Format("City :{0}", XmlData.City) + Environment.NewLine;
MessageBox.Show(data);
}
}
}
public
static void Serialize(AddressDetails details)
{
XmlSerializer serializer =
new XmlSerializer(typeof(AddressDetails));
using (TextWriter writer = new StreamWriter(@"D:\Om\myXml.xml"))
{
serializer.Serialize(writer, details);
}
}
this is prgram u have me and class file also I createddarma tejaPosted Jul 22, 2013, 5:41 AM
om prakashPosted Jul 22, 2013, 5:40 AM