RoboZhando/Redis/Serialize/RedisConvert.cs
/// <summary>
/// Deserializes a dictionary into a object
/// </summary>
/// <typeparam name="T">The type</typeparam>
/// <param name="buffer">The data that was received by the redis</param>
/// <returns></returns>
Deserializes a dictionary into a object
Deserializes a dictionary into a object
public static T Deserialize<T>(Dictionary<string, string> buffer)
		{
            if (buffer == null)
                return default(T);
			Type type = typeof(T);
			var constructor = type.GetConstructor(new Type[0]);
            if (constructor == null) throw new MissingMethodException(type.FullName, "constructor()");
			object reference = constructor.Invoke(new object[0]);
			if (!Deserialize(buffer, type, ref reference)) return default(T);
			return (T) reference;
		}
public static T Deserialize < T > ( Dictionary < string , string > buffer ) { if ( buffer == null ) return default ( T ) ; Type type = typeof ( T ) ; var constructor = type . GetConstructor ( new Type [ 0 ] ) ; if ( constructor == null ) throw new MissingMethodException ( type . FullName , " " ) ; object reference = constructor . Invoke ( new object [ 0 ] ) ; if ( ! Deserialize ( buffer , type , ref reference ) ) return default ( T ) ; return ( T ) reference ; }
Deserializes a dictionary into a object
Deserializes a dictionary into a object
//Buffer is null, return default. //Prepare the type //Create the reference and deserialize //Deserialize, returning default if we find jack all //Return a cast
None
buffer
Dictionary<string, string>
The data that was received by the redis
The data that was received by the redis
typeparam
None