Search code examples
c#filepathapplication-resource

C#: Reference Application Resource File


If I have a File Default.html in my project

alt text

How can I read it in code? I need the path

One Possible Solution

./Controls/MarkdownEditor/Templates/Default.html works too. Also I set "Copy to output directory" to "Copy if newer"


Solution

  • Normally using this:

       Assembly.GetExecutingAssembly().GetManifestResourceStream(
                "MarkDownEditMVVM.Controls.MarkDownWditor.Templates.Default.Html");
    

    Unless you are using special namespaces.