Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all API 'new FileSystem()' utilization to consume a static instance #2114

Closed
michaelcfanning opened this issue Oct 15, 2020 · 0 comments · Fixed by #2115
Closed

Convert all API 'new FileSystem()' utilization to consume a static instance #2114

michaelcfanning opened this issue Oct 15, 2020 · 0 comments · Fixed by #2115
Assignees

Comments

@michaelcfanning
Copy link
Member

We have patterns in code where API consult a parameter (which may be a test mock) and otherwise instantiate an instance of FileSystem() to perform work.

Rather than instantiating this class for each method call, we should have a singleton property (named Instance) that we use instead. The default file system capability is effectively a static helper class.

After this work, patterns like so:

fileSystem ??= new FileSystem();

will look like this:

fileSystem ??= FileSystem.Instance;

@eddynaka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants