static void SerializeInSoap(Maruti marutiObj) { FileStream soapFileStream = new FileStream(@"../../maruti.soap", FileMode.OpenOrCreate); SoapFormatter soapFormatter = new SoapFormatter(); soapFormatter.Serialize(soapFileStream, marutiObj); }
static void SerializeInBinary(Maruti marutiObj) { FileStream binaryFileStream = new FileStream(@"../../maruti.bin", FileMode.OpenOrCreate); BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(binaryFileStream, marutiObj); }
public IAuto CreateAutoMobile() { var bmw = new Maruti(); bmw.ModelName = "Maruti Swift VDI"; return(bmw); }
public static void Main() { Maruti car1 = new Maruti("Swift", 2015); Mahindra car2 = new Mahindra("Swift", 2015); Console.WriteLine("Car1 Details:"); Console.WriteLine("Name: {0} and Manufecturing Year: {1}", car1.Name, car1.MfgYear); }
static void Main(string[] args) { Car car = new Maruti(); car.displayBrand(); Console.ReadLine(); }
public static void Main() { Maruti mu = new Maruti("maruti", 10, 2.1); Mahindra ma = new Mahindra("mahindra", 20, 3.1); mu.Display(); ma.Display(); }
public static void Main() { Maruti car1 = new Maruti("Swift"); car1.haveAGS = true; car1.Name = "Swift"; Console.WriteLine("Details Car 1: {0} and {1}", car1.Name, car1.haveAGS == true?"Have AGS":"not Have AGS"); Mahindra car2 = new Mahindra(); car2.Name = "XUV500"; Console.WriteLine("Car 2: {0}", car2.Name); }
static void SerializeInXml(Maruti marutiObj) { FileStream xmlFileStream = new FileStream(@"../../maruti.xml", FileMode.OpenOrCreate); //Type marutiType = marutiObj.GetType(); Type marutiType = typeof(Maruti); Type carType = typeof(Car); Type audioType = typeof(AudioSystem); Type[] otherTypes = new Type[] { carType, audioType }; XmlSerializer xmlFormatter = new XmlSerializer(marutiType, otherTypes); xmlFormatter.Serialize(xmlFileStream, marutiObj); }