forked from ServiceStack/ServiceStack.Text
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCsvStreamExtensions.cs
More file actions
34 lines (30 loc) · 851 Bytes
/
Copy pathCsvStreamExtensions.cs
File metadata and controls
34 lines (30 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// https://github.com/ServiceStack/ServiceStack.Text
// ServiceStack.Text: .NET C# POCO JSON, JSV and CSV Text Serializers.
//
// Authors:
// Demis Bellot (demis.bellot@gmail.com)
//
// Copyright 2012 Service Stack LLC. All Rights Reserved.
//
// Licensed under the same terms of ServiceStack.
//
using System.Collections.Generic;
using System.IO;
namespace ServiceStack.Text
{
public static class CsvStreamExtensions
{
public static void WriteCsv<T>(this Stream outputStream, IEnumerable<T> records)
{
using (var textWriter = new StreamWriter(outputStream))
{
textWriter.WriteCsv(records);
}
}
public static void WriteCsv<T>(this TextWriter writer, IEnumerable<T> records)
{
CsvWriter<T>.Write(writer, records);
}
}
}