简体   繁体   中英

How can I get the name and location of a sound file resource in C#?

I have a sound.wav file on my resources folder in my C# project. I found that I can use the file using:

Properties.Resources.soundImage

But the code above gives me a stream. What I need is the name and if it is possible, the path to the file. Is there any way to get them?

Since we see that it is part of Properties.Resources , we can tell that it is actually a compiled resource. This means it is embedded in the .NET assembly (.exe or .dll).

While it starts out as a file in your project, the compiler actually plops it into your output file. So when your application is running, there is no filename for you to get.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM