/// <summary>
        /// Parses a Redis string to an object.
        /// </summary>
        /// <param name="value">The string value to parse.</param>
        /// <param name="toType">The type of the object to parse.</param>
        /// <returns>The parsed object.</returns>
        /// <exception cref="ArgumentNullException">Parameter <paramref name="toType"/> is null.</exception>
        /// <exception cref="NotSupportedException">Type <paramref name="toType" /> is not supported.</exception>
        public static object ParseValue(string value, Type toType)
        {
            if (toType == null)
            {
                throw new ArgumentNullException("toType");
            }

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

            if (toType.IsGenericType && toType.GetGenericTypeDefinition() == typeof(Nullable <>))
            {
                if (string.IsNullOrEmpty(value))
                {
                    return(null);
                }

                toType = toType.GetGenericArguments()[0];
            }

            if (toType == typeof(int))
            {
                return(RedisConverter.ParseInteger(value));
            }

            if (toType == typeof(long))
            {
                return(RedisConverter.ParseLong(value));
            }

            if (toType == typeof(float))
            {
                return(RedisConverter.ParseFloat(value));
            }

            if (toType == typeof(double))
            {
                return(RedisConverter.ParseDouble(value));
            }

            if (toType == typeof(Guid))
            {
                return(RedisConverter.ParseGuid(value));
            }

            if (toType == typeof(TimeSpan))
            {
                return(RedisConverter.ParseTimeSpan(value));
            }

            if (toType == typeof(DateTime))
            {
                return(RedisConverter.ParseDateTime(value));
            }

            if (toType == typeof(bool))
            {
                return(RedisConverter.ParseBoolean(value));
            }

            if (toType.IsEnum)
            {
                return(RedisConverter.ParseEnum(value, toType));
            }

            if (toType == typeof(Type))
            {
                return(RedisConverter.ParseType(value));
            }

            if (toType == typeof(Version))
            {
                return(RedisConverter.ParseVersion(value));
            }

            throw new NotSupportedException <Type>(toType);
        }
 /// <summary>
 /// Parses a Redis string to an enumeration value.
 /// </summary>
 /// <typeparam name="TEnum">The enumeration type.</typeparam>
 /// <param name="value">The string value to parse.</param>
 /// <returns>The parsed enumeration value.</returns>
 /// <exception cref="ArgumentNullException">Parameter <paramref name="value"/> is null.</exception>
 /// <exception cref="ArgumentException">Parameter <paramref name="value"/> cannot be parsed to <typeparamref name="TEnum"/>.</exception>
 public static TEnum ParseEnum <TEnum>(string value)
 {
     return((TEnum)RedisConverter.ParseEnum(value, typeof(TEnum)));
 }