示例#1
0
        /* * * * * * * * * * * * * * * *
        * Section 8.7.1 ExpandoObject *
        * * * * * * * * * * * * * * * */
        void UseExpandoObject()
        {
            dynamic expando = new System.Dynamic.ExpandoObject();

            expando.thing  = "im a thing";
            expando.dodad  = 1;
            expando.widget = 1.0f;
            expando.gizmo  = (Action)(() => { Debug.Log(expando.thing); });

            Debug.Log(expando.thing.GetType() + " " + expando.thing);
            // System.String im a thing
            Debug.Log(expando.dodad.GetType() + " " + expando.dodad);
            // System.Int32 1
            Debug.Log(expando.widget.GetType() + " " + expando.widget);
            // System.Single 1
            expando.gizmo();
            // im a thing
        }