/// <summary>
 /// Precompile the specified type
 /// </summary>
 /// <typeparam name="T"></typeparam>
 public static void Compile <T>()
 {
     if (typeof(T).IsCollectionAssignable())
     {
         CustomBinary.GetSerializer <InternalWrapper <T> >();
         return;
     }
     CustomBinary.GetSerializer <T>();
 }
 /// <summary>
 /// Deserialize stream into T type
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="stream"></param>
 /// <returns></returns>
 public static T Deserialize <T>(Stream stream)
 {
     if (typeof(T).IsCollectionAssignable())
     {
         var obj = CustomBinary.GetSerializer <InternalWrapper <T> >().Deserialize(stream);
         return(obj.Value);
     }
     return(CustomBinary.GetSerializer <T>().Deserialize(stream));
 }
 /// <summary>
 /// Serialize value into a byte array
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="value"></param>
 /// <returns></returns>
 public static byte[] Serialize <T>(T value)
 {
     if (value is ICollection)
     {
         return(CustomBinary.GetSerializer <InternalWrapper <T> >().Serialize(new InternalWrapper <T> {
             Value = value
         }));
     }
     return(CustomBinary.GetSerializer <T>().Serialize(value));
 }
 /// <summary>
 /// Serialize value to specified stream
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="value"></param>
 /// <param name="stream"></param>
 public static void Serialize <T>(T value, Stream stream)
 {
     if (value is ICollection)
     {
         CustomBinary.GetSerializer <InternalWrapper <T> >().Serialize(new InternalWrapper <T> {
             Value = value
         }, stream);
     }
     else
     {
         CustomBinary.GetSerializer <T>().Serialize(value, stream);
     }
 }