C# ExpandoObject用法

weixin_34414196發表於2017-07-31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Dynamic;//新增引用

namespace ExpandoObject_exercise
{
    class Program
    {
        static void Main(string[] args)
        {
            dynamic expand = new ExpandoObject();
            expand.name = "dynamic動態";
            expand.yes = "成功";
            Console.WriteLine("{0}\n{1}", expand.name, expand.yes);
            Console.Read();
        }
    }
}

結果:

 

轉載於:https://www.cnblogs.com/lbonet/p/7262610.html

相關文章