Exemple #1
0
        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)
        {
            switch (binder.Name)
            {
            case "Attributes":
                result = new SimpleXmlAttributes(_element);
                break;

            case "Value":
                result = _element.Value;
                break;

            default:
                var element = _element.Element(binder.Name);
                if (element == null)
                {
                    result = null;
                }
                else
                {
                    result = new SimpleXmlElement(element);
                }
                break;
            }

            return(result != null);
        }
Exemple #2
0
        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)
        {
            switch (binder.Name)
            {
                case "Attributes":
                    result = new SimpleXmlAttributes(_element);
                    break;
                case "Value":
                    result = _element.Value;
                    break;
                default:
                    var element = _element.Element(binder.Name);
                    if (element == null)
                        result = null;
                    else
                        result = new SimpleXmlElement(element);
                    break;
            }

            return result != null;
        }