I am looking for a way to conveniently store image files or any kind of file, ie without just saving them somewhere in my project folders and keeping track of the files in some list/xml/something.
What I am looking for is something like a 'bundle', which I can easily access and query in c#/.net .. eg I can easily find out what files it contains.
The whole point is that I don't want to have a messy subfolder containing all those files and I want to avoid using the filesystem's querying, access and referencing methods.
Is there something out there you could recommend?
Learn about resources in NET. Resources in Applications
Basically you can package resources to a dll and access them with a ResourceManager and a ResourceSet
As George already said simply use this procedure:
Add - New Item
. Resource File
and give that file a meaningful name. Add Resource
Button at the top and add the file(s) you want. Now you can access these resources within your project by simply entering
var myResource = ResourceFileName.ResourceName
Within the Resource Editor you can also select an already selected resource and take a look into the Properties window. There you can change the FileType of the resource. This has an impact on the return type you'll get within your code (eg a binary file will be returned as byte[]
, but a text file as string
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.