diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2019-02-19 21:24:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-19 21:24:51 -0500 |
| commit | 89d4ce309dfd63546d032e19bb1c186af7871af6 (patch) | |
| tree | c00a3aef679a7b419e8d2298b7c063dd4d5ec23f /Emby.Server.Implementations/Serialization/JsonSerializer.cs | |
| parent | b43317c5e10aeac5dd1510c3957fa59f453cf2c1 (diff) | |
| parent | 4811e76860c9ad71c14dc8548e70ef001458bf80 (diff) | |
Merge pull request #848 from Bond-009/perf
Minor changes to reduce allocations
Diffstat (limited to 'Emby.Server.Implementations/Serialization/JsonSerializer.cs')
| -rw-r--r-- | Emby.Server.Implementations/Serialization/JsonSerializer.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs index 44898d498..8ae7fd90c 100644 --- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs +++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs @@ -42,6 +42,27 @@ namespace Emby.Server.Implementations.Serialization } /// <summary> + /// Serializes to stream. + /// </summary> + /// <param name="obj">The obj.</param> + /// <param name="stream">The stream.</param> + /// <exception cref="ArgumentNullException">obj</exception> + public void SerializeToStream<T>(T obj, Stream stream) + { + if (obj == null) + { + throw new ArgumentNullException(nameof(obj)); + } + + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + ServiceStack.Text.JsonSerializer.SerializeToStream<T>(obj, stream); + } + + /// <summary> /// Serializes to file. /// </summary> /// <param name="obj">The obj.</param> |
