1

I can't use Settings because there's an external file. Is there any way to embed settings or otherwise embed data within the executable?

I need to be able to launch the application and have data saved from within and not loaded elsewhere.

Thanks

Ryan Peschel
  • 11,087
  • 19
  • 74
  • 136

2 Answers2

5

What kind of data are you talking about? A file of strings? A single String of text? If it's a file, changing the "Build Action" property of the file to "Embedded Resource" will in fact embed the file.

If they are single strings, add a new file to your project, a Resources File (.resx), and mark that file as an "Embedded Resource".

Here's a similar question where there is code to show how to read a specific string: read string from .resx file in C#

Community
  • 1
  • 1
JNadal
  • 408
  • 2
  • 8
2

The best way is to use a resources file for this. It generates a nice static class to use and is easily localizable if you do multiple languages.

Steve Danner
  • 21,818
  • 7
  • 41
  • 51