Prafulla
Prafulla

Reputation: 281

How to add custom attribute or tag to file using C#?

I have a folder with large number of files and application which shows these files in WPF list view. I want to allow user to group these files logically and display in treeview to make navigation easier. This can be done by putting files in to sub folders and this is not possible for some reasons. Another option is to create xml file to manage gropuing , but needs additional file. I want to add custome attibute or tag to file programmatically and read/write it as needed. The solution should work on most of windows os like xp,windows server 2003,vista & W7. Is this possible? Any other solution for logical grouping of files is also welcomed. Thanks.

Upvotes: 1

Views: 3695

Answers (2)

Dean Chalk
Dean Chalk

Reputation: 20461

The best solution (in my opinion) is to have an XML file in each folder (as per your original thoughts) that describes the grouping . You could make the file hidden, so that the users are not aware of it, or maybe the XML file could be stored in IsolatedStorage if the grouping is on a per0user basis

Upvotes: 1

fenix2222
fenix2222

Reputation: 4730

You could create your own logical grouping using database. This would be the best method without modifying existing files. I would suggest using RavenDB which is very very easy to use and has small footprint. You can use linq with it and no need for sql. All operation can be saved to memory too.

http://ravendb.net/

Upvotes: 1

Related Questions