We have an internal extensions library for IFileSystem that adds various nice extension methods like Unzip(...) and DeleteDirectoryContents(...).
Because these need to use operations on a mixture of FileBase, DirectoryBase and PathBase, these currently need to be extension methods on IFileSystem which isn't ideal:
- It's much less discoverable, particularly for things that really ought to live alongside a closely-related API like
DirectoryBase.Delete.
- It causes API breaks if you add functionality to an extension method on
FileBase and suddenly discover you need to move it to an IFileSystem one instead.
It would be extremely useful to expose the underlying IFileSystem on all these base classes as a property, which would fix this.
It would be a pretty trivial change, obviously, although as with any API addition would break anyone who has a custom implementations of FileBase, etc. as obviously they'd need to add it in (pretty trivial to fix, though).
Thoughts?
We have an internal extensions library for
IFileSystemthat adds various nice extension methods likeUnzip(...)andDeleteDirectoryContents(...).Because these need to use operations on a mixture of
FileBase,DirectoryBaseandPathBase, these currently need to be extension methods onIFileSystemwhich isn't ideal:DirectoryBase.Delete.FileBaseand suddenly discover you need to move it to anIFileSystemone instead.It would be extremely useful to expose the underlying
IFileSystemon all these base classes as a property, which would fix this.It would be a pretty trivial change, obviously, although as with any API addition would break anyone who has a custom implementations of FileBase, etc. as obviously they'd need to add it in (pretty trivial to fix, though).
Thoughts?