Skip to content

merge Validate clas into ArgumentValidation #2077

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

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

adamsitnik
Copy link
Member

use the new Path.Exists method to check for directory and file existance

Initially I wanted to reduce the number of public methods to two:

public static Argument<T> AcceptExistingPathOnly<T>(this Argument<T> argument)
    where T : FileSystemInfo

public static Argument<T> AcceptExistingPathsOnly<T>(this Argument<T> argument)
    where T : IEnumerable<FileSystemInfo>

But since the names are the same, the compiler emits an error.

I've also tried the following:

public static Argument<TC> AcceptExistingPathsOnly<TF, TC>(this Argument<TC> argument)
    where TF : FileSystemInfo
    where TC : IEnumerable<TF>

It works fine, but only when generic type arguments are provided in explicit way ;(

use the new Path.Exists method to check for directory and file existance
@adamsitnik adamsitnik merged commit 259d24f into dotnet:main Mar 7, 2023
@adamsitnik adamsitnik deleted the fileExtensions branch March 7, 2023 18:25
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 this pull request may close these issues.

2 participants