CreateSerializable() public static method

public static CreateSerializable ( string name, IValue @object, INode parent, Bender.Nodes.Object.Context context, CachedMember member = null, int index = null ) : ObjectNodeBase
name string
@object IValue
parent INode
context Bender.Nodes.Object.Context
member CachedMember
index int
return ObjectNodeBase
Example #1
0
 private IEnumerable <INode> EnumerateNodes()
 {
     return(_members.Value.Where(x => !x.IsNodeType).Select(x => Context.Mode == Mode.Deserialize ?
                                                            NodeFactory.CreateDeserializable(x.Name, x.Value, this, Context, x.Member) :
                                                            NodeFactory.CreateSerializable(x.Name, x.Value, this, Context, x.Member))
            .Concat(EnumerateNodeInstances()).ToList());
 }
Example #2
0
 private IEnumerable <INode> EnumerateNodes()
 {
     return(_dictionary.Value.AsEnumerable()
            .Where(x => x.Value != null && this.Walk <INode>(y => y.Parent).All(y => y.Value != x.Value))
            .Select(x => new
     {
         Name = x.Key.ToString(),
         Value = ValueFactory.Create(x.Value, _itemType, Context.Options)
     })
            .Where(x => x.Value.SpecifiedType, x => Context.Options, Context.Options.TypeFilter)
            .Select(x => x.Value.ActualType.CanBeCastTo <INode>() ? x.Value.Instance.As <INode>() :
                    NodeFactory.CreateSerializable(x.Name, x.Value, this, Context)).ToList());
 }
Example #3
0
        private IEnumerable <INode> EnumerateNodes()
        {
            // This is more of an internal check to make sure nothing
            // in the library enumerates multiple times.
            if (_enumerated)
            {
                throw new Exception("Should not enumerate more than once.");
            }
            _enumerated = true;
            var index = 0;

            return(Value.As <IEnumerable>().Cast <object>()
                   .Where(x => x != null && this.Walk <INode>(y => y.Parent).All(y => y.Value != x))
                   .Select(x => ValueFactory.Create(x, _itemType, Context.Options))
                   .Where(x => x.SpecifiedType, x => Context.Options, Context.Options.TypeFilter)
                   .Select(x => x.ActualType.CanBeCastTo <INode>() ? x.Instance.As <INode>() :
                           NodeFactory.CreateSerializable(GetItemName(x.SpecifiedType),
                                                          x, this, Context, index: index++)));
        }