コード例 #1
0
ファイル: Body.cs プロジェクト: erikvk/RESTable
 /// <summary>
 /// Populates the body onto each entity in a source collection. If the body is empty,
 /// returns null.
 /// </summary>
 public IAsyncEnumerable <T> PopulateTo <T>(IAsyncEnumerable <T> source) where T : class
 {
     if (IsClosed)
     {
         throw new ObjectDisposedException(nameof(Stream));
     }
     if (source == null)
     {
         return(null);
     }
     try
     {
         return(ContentTypeProvider.Populate(source, Stream.GetBytes()));
     }
     finally
     {
         if (CanSeek)
         {
             Stream.Rewind();
         }
     }
 }