コード例 #1
0
        /// <summary>
        ///     Deserializes given type from stream.
        /// </summary>
        /// <typeparam name="T">deserialized value type.</typeparam>
        /// <param name="reader">source text reader.</param>
        /// <param name="streamingContext">payload object for StreamingContext; defaults to null.</param>
        /// <param name="leaveOpen">leave stream open; defaults to false.</param>
        /// <returns>deserialized value.</returns>
        public T Deserialize <T>(TextReader reader, Object streamingContext = null, bool leaveOpen = false)
        {
            var sc = Utils.GetStreamingContext(streamingContext);
            var lo = Utils.GetLeaveOpen(leaveOpen);

            return(_textPickler.Deserialize <T>(reader, streamingContext: sc, leaveOpen: lo));
        }
コード例 #2
0
ファイル: TextSerializer.cs プロジェクト: s952163/FsPickler
        /// <summary>
        ///     Deserializes given type from stream.
        /// </summary>
        /// <typeparam name="T">deserialized value type.</typeparam>
        /// <param name="reader">source text reader.</param>
        /// <param name="streamingContext">payload object for StreamingContext; defaults to null.</param>
        /// <param name="leaveOpen">leave stream open; defaults to false.</param>
        /// <returns>deserialized value.</returns>
        public T Deserialize <T>(TextReader reader, Object streamingContext = null, bool leaveOpen = false)
        {
            var sc = Utils.GetStreamingContext(streamingContext);

            return(_textSerializer.Deserialize <T>(reader, streamingContext: sc.ToOption(), leaveOpen: leaveOpen.ToOption()));
        }