What's the difference between a Resource and an Embedded Resource in a C# application?

后端 未结 4 1953
南方客
南方客 2020-12-08 03:36

When should I use one or the other?

I\'d like all of the files I use in my app (images, sound, xml file, etc.) to be inside of the .exe file so I don\'t deploy with

4条回答
  •  一生所求
    2020-12-08 04:03

    A WPF resource (build action = Resource) leverages embedded resources as supported by the core .NET framework, but adds support for accessing the embedded resource via a pack URI. From MSDN:

    WPF resource files are not the same as the embedded or linked type of resources that can be configured using the core .NET Framework support for assembly resources. While WPF resource files do leverage the core .NET Framework embedded resource support, the ability to access WPF resource files using pack URIs is easier than using namespaces.

提交回复
热议问题