How to embed a text file in a .NET assembly?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to embed a text file in an assembly so that I can load the text without having to read it from disk, and so that everything I need is contained within the exe. (So that it's more portable) Is there a way to do this? I assume something with the resource files? And if you can, how do you do it and how do you programaticaly load the text into a string? 回答1: Right-click the project file, select Properties. In the window that opens, go to the Resources tab, and if it has just a blue link in the middle of the tab-page, click it, to