コード例 #1
0
 /// <summary>
 ///     Deserialises a data transfer object (DTO) of type <typeparamref name="T"/> from
 ///     a byte array.
 /// </summary>
 /// <remarks>
 ///     Provides deserialisation capabilities for any object which derives from
 ///     <see cref="IDataTransferObject"/> and that has a <see cref="ProtoContractAttribute"/>
 ///     attribute (e.g. those from ObscurCore.DTO namespace).
 /// </remarks>
 /// <typeparam name="T">Data transfer object.</typeparam>
 /// <param name="input">The stream to read the serialised object from.</param>
 public static T DeserialiseDto <T>(this byte[] input)
     where T : IDataTransferObject
 {
     return(StratCom.DeserialiseDataTransferObject <T>(new MemoryStream(input), false));
 }
コード例 #2
0
 /// <summary>
 ///     Deserialises a data transfer object (DTO) of type <typeparamref name="T"/> from
 ///     a <see cref="System.IO.Stream"/>.
 /// </summary>
 /// <remarks>
 ///     Uses the serialiser in <see cref="StratCom"/>, <see cref="StratCom.Serialiser"/>.
 /// </remarks>
 /// <typeparam name="T">Data transfer object.</typeparam>
 /// <param name="input">The stream to read the serialised object from.</param>
 /// <param name="lengthPrefixed">
 ///     If <c>true</c>, the object is prefixed with its length in Base128 format.
 ///     If <c>false</c>, the whole stream will be read.
 /// </param>
 public static T DeserialiseDto <T>(this Stream input, bool lengthPrefixed)
     where T : IDataTransferObject
 {
     return(StratCom.DeserialiseDataTransferObject <T>(input, lengthPrefixed));
 }