AmazedSaint.Elastic.Lib.ElasticObject.TryInvokeMember C# (CSharp) Method

TryInvokeMember() public method

Interpret a method call
public TryInvokeMember ( System binder, object args, object &result ) : bool
binder System
args object
result object
return bool
        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)
        {
            var obj = new ElasticObject(binder.Name,null);

            foreach (var a in args)
            {
            #if NETFX_CORE
                foreach(var p in a.GetType().GetTypeInfo().DeclaredProperties)
                    AddAttribute(p.Name,p.GetValue(a,null));
            #else
                foreach (var p in a.GetType().GetProperties())
                    AddAttribute(p.Name,p.GetValue(a,null));
            #endif
            }

            AddElement(obj);
            result = obj;
            return true;
        }