Exemple #1
0
        private bool TrySetMemberCallback(SetMemberBinder binder, object?value)
        {
            JsonNode?node = null;

            if (value != null)
            {
                node = value as JsonNode;
                if (node == null)
                {
                    node = new JsonValueNotTrimmable <object>(value, Options);
                }
            }

            this[binder.Name] = node;
            return(true);
        }
Exemple #2
0
        public void Add <T>(T?value)
        {
            if (value == null)
            {
                Add(null);
            }
            else
            {
                JsonNode?jNode = value as JsonNode;
                if (jNode == null)
                {
                    jNode = new JsonValueNotTrimmable <T>(value);
                }

                // Call the IList.Add() implementation.
                Add(jNode);
            }
        }
Exemple #3
0
        public void Add <[DynamicallyAccessedMembers(JsonHelpers.MembersAccessedOnRead)] T>(T?value)
        {
            if (value == null)
            {
                Add(null);
            }
            else
            {
                JsonNode?jNode = value as JsonNode;
                if (jNode == null)
                {
                    jNode = new JsonValueNotTrimmable <T>(value);
                }

                // Call the IList.Add() implementation.
                Add(jNode);
            }
        }