-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathFormattingStreamWriter.cs
More file actions
31 lines (28 loc) · 1.05 KB
/
FormattingStreamWriter.cs
File metadata and controls
31 lines (28 loc) · 1.05 KB
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.IO;
namespace Microsoft.OpenApi.Writers
{
/// <summary>
/// A custom <see cref="StreamWriter"/> which supports setting a <see cref="IFormatProvider"/>.
/// </summary>
public class FormattingStreamWriter : StreamWriter
{
/// <summary>
/// Initializes a new instance of the <see cref="FormattingStreamWriter"/> class.
/// </summary>
/// <param name="stream"></param>
/// <param name="formatProvider"></param>
public FormattingStreamWriter(Stream stream, IFormatProvider formatProvider)
: base(stream)
{
_formatProvider = formatProvider;
}
private readonly IFormatProvider _formatProvider;
/// <summary>
/// The <see cref="IFormatProvider"/> associated with this <see cref="FormattingStreamWriter"/>.
/// </summary>
public override IFormatProvider FormatProvider { get => _formatProvider; }
}
}