public static PagingParams FromValue(object value)
        {
            if (value is PagingParams)
            {
                return((PagingParams)value);
            }

            var map = AnyValueMap.FromValue(value);

            return(FromMap(map));
        }
        public void TestGetAsString()
        {
            var message = AnyValueMap.FromTuples(
                "key1", 123,
                "key2", "ABC"
                );

            var restoredMessageObject = JsonConverter.FromJson <object>(JsonConverter.ToJson(message));
            var restoredMessage       = AnyValueMap.FromValue(restoredMessageObject);

            Assert.Equal(2, restoredMessage.Count);
            Assert.Equal(123, restoredMessage.GetAsInteger("key1"));
            Assert.Equal("ABC", restoredMessage.GetAsString("key2"));
        }
Esempio n. 3
0
 public AnyValueMap GetAsMap()
 {
     return(AnyValueMap.FromValue(Value));
 }
 public AnyValueMap GetAsMap(string key)
 {
     return(AnyValueMap.FromValue(GetAsObject(key)));
 }
        public AnyValueMap GetAsNullableMap(string key)
        {
            var result = GetAsObject(key);

            return(result != null?AnyValueMap.FromValue(result) : null);
        }
 public AnyValueMap GetAsMap(int index)
 {
     return(AnyValueMap.FromValue(GetAsObject(index)));
 }
        public AnyValueMap GetAsNullableMap(int index)
        {
            var value = GetAsObject(index);

            return(value != null?AnyValueMap.FromValue(value) : null);
        }