Ejemplo n.º 1
0
        public static SortParams FromValue(object value)
        {
            if (value is SortParams)
            {
                return((SortParams)value);
            }

            var array = value != null?AnyValueArray.FromValue(value) : new AnyValueArray();

            return(new SortParams(array));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts specified value into ProjectionParams.
        /// </summary>
        /// <param name="value">value to be converted</param>
        /// <returns>a newly created ProjectionParams.</returns>
        /// See <see cref="AnyValueArray.FromValue(object)"/>
        public static ProjectionParams FromValue(object value)
        {
            if (value is ProjectionParams)
            {
                return((ProjectionParams)value);
            }

            var array = value != null?AnyValueArray.FromValue(value) : new AnyValueArray();

            return(new ProjectionParams(array));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
 /// </summary>
 /// <param name="key">a key of element to get.</param>
 /// <returns>AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.</returns>
 /// See <see cref="AnyValueArray.FromValue(object)"/>
 public AnyValueArray GetAsArray(string key)
 {
     return(AnyValueArray.FromValue(GetAsObject(key)));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Converts map element into an AnyValueArray or returns null if conversion is not possible.
        /// </summary>
        /// <param name="key">a key of element to get.</param>
        /// <returns>AnyValueArray value of the element or null if conversion is not supported.</returns>
        /// See <see cref="AnyValueArray"/>
        public AnyValueArray GetAsNullableArray(string key)
        {
            var value = GetAsObject(key);

            return(value != null?AnyValueArray.FromValue(value) : null);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Converts object value into an AnyArray or returns empty AnyArray if conversion is not possible.
 /// </summary>
 /// <returns>AnyArray value or empty AnyArray if conversion is not supported.</returns>
 /// See <see cref="AnyValueArray.FromValue(object)"/>
 public AnyValueArray GetAsArray()
 {
     return(AnyValueArray.FromValue(Value));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
        /// </summary>
        /// <param name="key">a key of element to get.</param>
        /// <returns>AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.</returns>
        /// See <see cref="AnyValueArray.FromValue(object)"/>
        public AnyValueArray GetAsArray(string key)
        {
            var value = GetAsObject(key);

            return(AnyValueArray.FromValue(key));
        }