Example #1
0
        public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)
        {
            if (!(indexes[0] is string))
            {
                return false;
            }

            _members[indexes[0] as string] = new MemberDescription(indexes[0] as string, value, new Type[] { });
            return true;
        }
Example #2
0
        static void Main(string[] args)
        {
            //dynamic codeToRun = new ExpandingAnyObjectTest();

            //dynamic temp = new ExpandoObject();
            //temp.Name = "Jamie";
            //temp.PrintName = new Action(() =>
            //{
            //    Console.WriteLine(temp.Name);
            //});

            //temp.PrintName();

            //Console.ReadLine();
            //codeToRun.Run();

            MemberDescription description = new MemberDescription("Some String", "jamie");
        }
Example #3
0
        public override bool TrySetMember(SetMemberBinder binder, object value)
        {
            if (value is Delegate)
            {
                var delegateMethod = value as Delegate;
                IEnumerable<Type> argumentTypes = MemberDescription.GetArgumentTypes(delegateMethod);

                var memberDescription = new MemberDescription(binder.Name, argumentTypes, new Type[] { });
                _members[binder.Name] = memberDescription;
            }

            var description = new MemberDescription(binder.Name, value, new Type[] { });
            _members[binder.Name] = description;
            return true;
        }