public object UnpackFrom(Unpacker unpacker) { if (unpacker == null) { throw new ArgumentNullException("unpacker"); } Contract.Ensures(Contract.Result <object>() == null); if (!unpacker.Data.HasValue) { throw SerializationExceptions.NewEmptyOrUnstartedUnpacker(); } // Always returns null. return(null); }
public void UnpackTo(Unpacker unpacker, object collection) { if (unpacker == null) { throw new ArgumentNullException("unpacker"); } if (collection == null) { throw new ArgumentNullException("collection"); } if (!(collection is T)) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "'{0}' is not compatible for '{1}'.", collection.GetType(), typeof(T)), "collection"); } if (!unpacker.Data.HasValue) { throw SerializationExceptions.NewEmptyOrUnstartedUnpacker(); } throw new NotSupportedException(String.Format(CultureInfo.CurrentCulture, "This operation is not supported by '{0}'.", this.GetType())); }