/// <summary> /// See <see cref="INodePolicy.GetAttribute"/> for details. /// </summary> public override Node GetAttribute(Node node, int index) { MemberInfo[] attributes = node.ObjectType.GetAttributes(); if (index >= 0 && index < attributes.Length) { Node attr = new Node(node.Context, MemberNodePolicy.GetPolicy()); attr.Member = attributes[index]; return(attr); } return(null); }
/// <summary> /// See <see cref="INodePolicy.GetChild"/> for details. /// </summary> public override Node GetChild(Node node, int index) { MemberInfo[] elements = node.ObjectType.GetElements(); if (index >= 0 && index < elements.Length) { INodePolicy policy; MemberInfo member = elements[index]; if (member.NodePolicy != null) { policy = node.Context.CreateNodePolicy(member.NodePolicy.NodePolicyType); } else { policy = MemberNodePolicy.GetPolicy(); } Node child = new Node(node.Context, policy); child.Member = member; return(child); } return(null); }