Created
August 21, 2017 22:52
-
-
Save kddlb/7e366bb25d8af7f9eeab0b6d4310c87c to your computer and use it in GitHub Desktop.
SillyDate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json; | |
namespace SillyDate | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var dateData = new Dictionary<string, int> | |
{ | |
{"year", DateTime.Now.Year}, | |
{"month", DateTime.Now.Month}, | |
{"day", DateTime.Now.Day} | |
}; | |
var serializeObject = JsonConvert.SerializeObject(dateData); | |
Console.WriteLine(serializeObject); | |
var dict = new Dictionary<string, string>() | |
{ | |
{"dateData",System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(serializeObject))} | |
}; | |
Console.WriteLine(JsonConvert.SerializeObject(dict)); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment