-
-
Couldn't load subscription status.
- Fork 2.5k
Description
What's the Problem?
There doesn't presently exist a standardized way to create a ListedItem from external constructs such as IStorageItem-derived types, WIN32_FIND_DATA, and IShellItem. We currently expose numerous public properties on ListedItem and expect users of it to automatically and correctly populate all of them.
This expectation adds a level of redundancy and duplication everywhere we have to create ListedItems, and is not good architecture.
Solution/Idea
We should discuss improving code quality in this area with all of the tasks below:
1. Define factory methods inside ListedItem.cs (draft)
public static ListedItem FromFindData(WIN32_FIND_DATAW findData, string dateReturnFormat = null)
public static ListedItem FromStorageItem(IStorageItem storageItem, string dateReturnFormat = null)
public static ListedItem FromShellItem(IShellItem shellItem, string dateReturnFormat = null)
2. Make all properties on ListedItem read only
3. Add a way to determine what type of external construct(s) back a ListedItem instance
Alternatives
Add multiple constructor overloads to ListedItem: This idea might not be ideal because we may access the filesystem directly when constructing the item.
Priorities
| Capability | Priority |
|---|---|
| This proposal will allow users of ListedItem to easily create one from external constructs in a standard way | Must |
| Add a way to determining the backing OS filesystem construct(s) | Could |
Files Version
v2
Windows Version
Windows 11 21H2
Additional comment
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status