示例#1
0
 /// <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);
 }
示例#2
0
 /// <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);
 }