Exemple #1
0
 public void DeserializeFileToDictionary()
 {
     //  Call appropriate class method by ftype
     if (FileType.Equals("csv"))
     {
         Serialize_Deserialize_CSV _CSV = new Serialize_Deserialize_CSV(FileName);
         CityCatalogue = _CSV.Deserialize();
     }
     else if (FileType.Equals("json"))
     {
         Serialize_Deserialize_JSON deserialize_JSON = new Serialize_Deserialize_JSON(FileName);
         CityCatalogue = deserialize_JSON.Deserialize();
     }
     else if (FileType.Equals("xml"))
     {
         Serialize_Deserialize_XML deserialize_XML = new Serialize_Deserialize_XML(FileName);
         CityCatalogue = deserialize_XML.Deserialize();
     }
 }
Exemple #2
0
        public string Serialize(string filetype)
        {
            string data = "";

            //  Call appropriate class method by ftype
            if (filetype.ToLower().Equals("csv"))
            {
                Serialize_Deserialize_CSV _CSV = new Serialize_Deserialize_CSV();
                data = _CSV.Serialize(CityCatalogue);
            }
            else if (filetype.ToLower().Equals("json"))
            {
                Serialize_Deserialize_JSON _JSON = new Serialize_Deserialize_JSON();
                data = _JSON.Serialize(CityCatalogue);
            }
            //else if (filetype.ToLower().Equals("xml"))
            //{
            //    Serialize_Deserialize_XML _XML = new Serialize_Deserialize_XML();
            //    data = _XML.Serialize(CityCatalogue);
            //}
            return(data);
        }