본문 바로가기
C#프로그래밍

신규유저 기존유저 직렬화 역직렬화

by 노재두내 2023. 7. 28.
GameInfo gameInfo = null;
            ////기존 유저
            //string json= File.ReadAllText("./game_info.json");
            //Console.WriteLine(json);
            //gameInfo = JsonConvert.DeserializeObject<GameInfo>(json);

            //신규유저
            gameInfo = new GameInfo();
            gameInfo.Init();
            string json = JsonConvert.SerializeObject(gameInfo);
            Console.WriteLine(json);
            File.WriteAllText("./game_info.json", json);
            Console.WriteLine("파일 저장 완료");

'C#프로그래밍' 카테고리의 다른 글

몬스터 바라보고 때리면 사라지기  (0) 2023.08.09
주말과제 미션 만들기  (1) 2023.07.30
아이템  (0) 2023.07.28
과제  (0) 2023.07.28
27일 복습  (0) 2023.07.27