Skip to content

Commit

Permalink
Simplify StreamWriter instantiation
Browse files Browse the repository at this point in the history
Refactor the instantiation of the `StreamWriter` object within a `using` statement by removing unnecessary parameters. The original code included `null` for encoding, `-1` for buffer size, and `true` for leaving the stream open. The updated code uses the default constructor, which only requires the `MemoryStream` object, as the default behavior is sufficient for the intended use case.
  • Loading branch information
paulomorgado committed Aug 20, 2024
1 parent d2241c1 commit ee45001
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace <#=this.Config.Namespace #>.Model.Internal.MarshallTransformations
#>
using (MemoryStream memoryStream = new MemoryStream())
{
using (StreamWriter streamWriter = new StreamWriter(memoryStream, null, -1, true))
using (StreamWriter streamWriter = new StreamWriter(memoryStream))
{
JsonWriter writer = new JsonWriter(streamWriter);
writer.Validate = false;
Expand Down

0 comments on commit ee45001

Please sign in to comment.