/// <summary>
        /// Converts a collection to a string that can be stored in Redis.
        /// </summary>
        /// <param name="collection">The collection to convert.</param>
        /// <returns>A string representation of the specified collection that can be stored in Redis.</returns>
        /// <exception cref="ArgumentNullException">Parameter <paramref name="collection"/> is null.</exception>
        public static string ToString(params object[] collection)
        {
            if (collection == null)
            {
                return(string.Empty);
            }

            return(string.Join(RedisConverter.ArraySeparatorAsString, collection.Select(c => RedisConverter.ToString(c))));
        }
        /// <summary>
        /// Converts an object to a string that can be stored in Redis.
        /// </summary>
        /// <param name="value">The object to convert.</param>
        /// <returns>A string representation of the specified object that can be stored in Redis.</returns>
        /// <exception cref="NotSupportedException">The type of the specified object is not supported.</exception>
        public static string ToString(object value)
        {
            if (value == null)
            {
                return(string.Empty);
            }

            Type type = value.GetType();

            if (type == typeof(string))
            {
                return((string)value);
            }

            if (type == typeof(int))
            {
                return(RedisConverter.ToString((int)value));
            }

            if (type == typeof(long))
            {
                return(RedisConverter.ToString((long)value));
            }

            if (type == typeof(float))
            {
                return(RedisConverter.ToString((float)value));
            }

            if (type == typeof(double))
            {
                return(RedisConverter.ToString((double)value));
            }

            if (type == typeof(Guid))
            {
                return(RedisConverter.ToString((Guid)value));
            }

            if (type == typeof(TimeSpan))
            {
                return(RedisConverter.ToString((TimeSpan)value));
            }

            if (type == typeof(DateTime))
            {
                return(RedisConverter.ToString((DateTime)value));
            }

            if (type == typeof(bool))
            {
                return(RedisConverter.ToString((bool)value));
            }

            if (type == typeof(Version))
            {
                return(RedisConverter.ToString((Version)value));
            }

            if (type.IsEnum)
            {
                return(value.ToString());
            }

            if (typeof(IEnumerable).IsAssignableFrom(type))
            {
                return(RedisConverter.ToString(((IEnumerable)value).Cast <object>().ToArray()));
            }

            throw new NotSupportedException <Type>(type);
        }