HasMember() 개인적인 메소드

private HasMember ( string member ) : bool
member string
리턴 bool
예제 #1
0
        private DynamicMetaObject TryBindGetMember(string name)
        {
            if (_lib.HasMember(name))
            {
                BindingRestrictions restrictions =
                    BindingRestrictions.GetTypeRestriction(
                        Expression, typeof(ComTypeLibDesc)
                        ).Merge(
                        BindingRestrictions.GetExpressionRestriction(
                            Expression.Equal(
                                Expression.Property(
                                    AstUtils.Convert(
                                        Expression, typeof(ComTypeLibDesc)
                                        ),
                                    typeof(ComTypeLibDesc).GetProperty("Guid")
                                    ),
                                AstUtils.Constant(_lib.Guid)
                                )
                            )
                        );

                return(new DynamicMetaObject(
                           AstUtils.Constant(
                               ((ComTypeLibDesc)Value).GetTypeLibObjectDesc(name)
                               ),
                           restrictions
                           ));
            }

            return(null);
        }
예제 #2
0
        public override MetaObject BindGetMember(GetMemberBinder binder)
        {
            if (_lib.HasMember(binder.Name))
            {
                Restrictions restrictions =
                    Restrictions.GetTypeRestriction(
                        Expression, typeof(ComTypeLibDesc)
                        ).Merge(
                        Restrictions.GetExpressionRestriction(
                            Expression.Equal(
                                Expression.Property(
                                    AstUtils.Convert(
                                        Expression, typeof(ComTypeLibDesc)
                                        ),
                                    typeof(ComTypeLibDesc).GetProperty("Guid")
                                    ),
                                Expression.Constant(_lib.Guid)
                                )
                            )
                        );

                return(new MetaObject(
                           Expression.Constant(
                               ((ComTypeLibDesc)Value).GetTypeLibObjectDesc(binder.Name)
                               ),
                           restrictions
                           ));
            }

            return(base.BindGetMember(binder));
        }