开发者

Check if a packed resource exists in WPF

开发者 https://www.devze.com 2022-12-12 12:48 出处:网络
Is there a way to check in code if a resource exists at an Uri su开发者_运维技巧ch as: \"pack://application:,,,/MyResource.jpg\"

Is there a way to check in code if a resource exists at an Uri su开发者_运维技巧ch as:

"pack://application:,,,/MyResource.jpg"


Just chop off the pack://application:,,,/ part of the string and do a File.Exists on the remaining part of the path.

Your snippet you posted is pointing to a file that lives in the root of the running application and is called MyResource.jpg.

0

精彩评论

暂无评论...
验证码 换一张
取 消