I want to embed a dictionary.txt which my program uses a streamreader object to parse. I tried to add it to resources but then the streamreader had an error. How can it be properly done?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First you need to embed the file in your assembly (add to project and goto Properties for the file, and set Build Action to “Embedded Resource”).
Then you need to access and read it’s contents using GetManifestResourceStream():
Getting an embedded resource file out of an assembly
This article might be of interest: Microsoft .NET Framework Resource Basics