Example #1
0
        static void SerializeInSoap(Maruti marutiObj)
        {
            FileStream    soapFileStream = new FileStream(@"../../maruti.soap", FileMode.OpenOrCreate);
            SoapFormatter soapFormatter  = new SoapFormatter();

            soapFormatter.Serialize(soapFileStream, marutiObj);
        }
Example #2
0
        static void SerializeInBinary(Maruti marutiObj)
        {
            FileStream      binaryFileStream = new FileStream(@"../../maruti.bin", FileMode.OpenOrCreate);
            BinaryFormatter binaryFormatter  = new BinaryFormatter();

            binaryFormatter.Serialize(binaryFileStream, marutiObj);
        }
Example #3
0
        public IAuto CreateAutoMobile()
        {
            var bmw = new Maruti();

            bmw.ModelName = "Maruti Swift VDI";
            return(bmw);
        }
Example #4
0
    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);
    }
Example #5
0
        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();
    }
Example #7
0
    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);
    }
Example #8
0
        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);
        }