首页 > 编程语言 >C#动态创建对象和其属性

C#动态创建对象和其属性

时间:2022-12-06 11:13:57浏览次数:43  
标签:C# 创建对象 contact ExpandoObject Address new 属性

        dynamic contact = new ExpandoObject();
            contact.Name = "Patrick Hines";
            contact.Phone = "206-555-0144";
            contact.Address = new ExpandoObject();
            contact.Address.Street = "123 Main St";
            contact.Address.City = "Mercer Island";
            contact.Address.State = "WA";
            contact.Address.Postal = "68402";
            string res = JsonConvert.SerializeObject(contact);

  

标签:C#,创建对象,contact,ExpandoObject,Address,new,属性
From: https://www.cnblogs.com/wzf-Learning/p/16954639.html

相关文章