Skip to content

"use base type whenever possible" refactoring #11

Open
@tugberkugurlu

Description

@tugberkugurlu

This is more for a discussion than a proposal as I'm not sure how this can be done and handled because I assume there are lots of legit and corner cases to cover here even if I was able to only come up with one below.

For the below case for example, it would be possible to use Stream instead of FileStream:

using (FileStream stream = File.Open(@"c:\dev\foo.txt", FileMode.Open))

Cases to cover:

  • We need to make sure that any members that are specific to FileStream is not used inside the code block.
  • return signature might be FileStream for the method and the stream could be instance which is being returned.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions