dotnet / dotnet/dotnet-api-docs

fewer new operations please

Open
#1,416 0 comments 0 reactions 0 assignees View on GitHub
area-System.IO dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

the first example has AddText routine conduct frequent new operations which is surely a code-smell
byte[] info = new UTF8Encoding(true).GetBytes(value);

IMHO guideline code should assign that to a class-wide variable ONCE and then use that prepared object thereafter
- yes even if this is demoware!

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 968f92e0-aae5-7107-de5e-cdbbfe2f5daa
* Version Independent ID: ccf9cf00-2d05-3483-9530-470e18ae8e33
* Content: [FileStream Class (System.IO)](https://docs.microsoft.com/en-us/dotnet/api/system.io.filestream?view=netframework-4.7.2)
* Content Source: [xml/System.IO/FileStream.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.IO/FileStream.xml)
* Product: **dotnet-api**
* GitHub Login: @mairaw
* Microsoft Alias: **mairaw**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.