Skip to content

merge Validate clas into ArgumentValidation#2077

Merged
adamsitnik merged 1 commit intodotnet:mainfrom
adamsitnik:fileExtensions
Mar 7, 2023
Merged

merge Validate clas into ArgumentValidation#2077
adamsitnik merged 1 commit intodotnet:mainfrom
adamsitnik:fileExtensions

Conversation

@adamsitnik
Copy link
Copy Markdown
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
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