Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Runtime.Serialization.Json;
- using System.Text;
- using System.Threading.Tasks;
- using MessageLib;
- namespace ConsoleApp2
- {
- public class Program
- {
- static void Main(string[] args)
- {
- try
- {
- DataContractJsonSerializer jsonFormatter = new DataContractJsonSerializer(typeof(MessageBox));
- using (FileStream fs = new FileStream(@"..\..\..\ConsoleApp1\bin\Debug\messageBox.json", FileMode.Open))
- {
- MessageBox messageBox = (MessageBox)jsonFormatter.ReadObject(fs);
- foreach (var message in messageBox)
- Console.WriteLine(message.ToString());
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement