C# 元组的demo

 

 

// See https://aka.ms/new-console-template for more information

Console.WriteLine("Hello, World!");

string name = "马良";
int age = 16;

var a = (Name:name, Age:age,1,2,3,4,5,6,7,8,9,0);

(string a1, int a2) = (name, age);

var unname = new { name = 100, b = "马良" };
Console.WriteLine( Newtonsoft.Json.JsonConvert.SerializeObject(unname));


string b= Newtonsoft.Json.JsonConvert.SerializeObject(a);
Console.WriteLine(b);

Console.WriteLine(a1);
Console.WriteLine(a2);

Console.ReadKey();

  

posted on 2023-10-09 19:09  漫思  阅读(8)  评论(0编辑  收藏  举报

导航