Skip to content

[API Proposal]: Add FileAttributes.None #83125

Closed
@meziantou

Description

@meziantou

Background and motivation

Similar to #79868, but for System.IO.FileAttributes.

One use-case for the 0 value is when enumerating files. 0 allows to not exclude files from enumeration based on their attributes.

new System.IO.EnumerationOptions()
{
    AttributesToSkip = 0,
}

API Proposal

namespace System.IO;

[System.Flags]
public enum FileAttributes
{
    None = 0,

    // Existing values:
    // ReadOnly
    // Hidden
    // ...

API Usage

Directory.EnumerateFiles("folder", "*", new System.IO.EnumerationOptions()
{
    AttributesToSkip = FileAttributes.None,
});

Could also be used in

if (!isSpecialDirectory && _options.AttributesToSkip != 0)

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.IOgood first issueIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions