コード例 #1
0
        /// <summary>
        /// Volgens de documentatie kan je geen List of ArrayList serialiseren, alleen gewone arrays. daarom maken we de methode om om te zetten in Array
        /// </summary>
        /// <returns></returns>
        public static Postcode[] GetPostcodeArray()
        {
            string[]   lines     = TryOut.ReadFromCSVFile().Split('\n');
            Postcode[] postcodes = new Postcode[lines.Length];
            int        i         = 0;

            foreach (string s in lines)
            {
                if (s.Length > 0)
                {
                    postcodes[i++] = TryOut.PostcodeCsvToObject(s);
                }
            }
            return(postcodes);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: timjanssens/Programmeren3
        static void Main(string[] args)
        {
            Console.WriteLine(TryOut.ReadPostcodesFromCSVFile());
            // zet stringvoorstelling postcodes om in een lijst
            // van postcode-objecten en toon de lijst in de console

            TryOut.ListPostcodes(TryOut.GetPostcodeList());

            Console.WriteLine(TryOut.SerializeObjectToCsv(TryOut.GetPostcodeList(), "|"));


            TryOut.SerializeCsvToXml();
            TryOut.ListPostcodes(TryOut.GetPostcodeListFromXml());

            TryOut.SerializeCsvToJson();
            TryOut.ListPostcodes(TryOut.GetPostcodeListFromJson());

            Console.ReadKey();
        }