var assembly = Assembly.GetExecutingAssembly(); var resourceName = "C://reza.txt"; string result = ""; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { result = reader.ReadToEnd(); }
System.ArgumentNullException was unhandled Message=Value cannot be null. Parameter name: stream Source=mscorlib ParamName=stream StackTrace: at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) at System.IO.StreamReader..ctor(Stream stream) at SendEmail.Program.Email(String ename, String name) in C:\Users\Reza\Desktop\Test_Projects\C#\SendEmail\SendEmail\Program.cs:line 44 at SendEmail.Program.Main(String[] args) in C:\Users\Reza\Desktop\Test_Projects\C#\SendEmail\SendEmail\Program.cs:line 21 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)