Пример #1
0
        private void ToJsonSample()
        {
            SampleModel arg1 = new SampleModel();

            arg1.Id   = 1;
            arg1.Name = "hoge";

            string result1 = arg1.ToJson();

            Console.WriteLine(result1);
            // => "{"Id":1,"Name":"hoge"}"

            SampleModel arg2    = null;
            string      result2 = arg2.ToJson();

            Console.WriteLine(result2);
            // => ""
        }