Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #5410
| From | CarolHudson <CarolHudson0@yahoo.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: c# .net 4 unable to move file - file in use by another process (by itself) |
| Date | 2015-04-22 21:05 +0200 |
| Organization | Killfiles, Unlimited |
| Message-ID | <mh8rdc$t7f$1@flea.killfile.org> (permalink) |
| References | <4c284fb9-3878-43e0-9d11-85b7c33ce269@googlegroups.com> <54fe757c-e9cb-498f-8a01-6da94ee73537@googlegroups.com> <e9bfb46e-f63f-4d61-931d-7b2765439841@googlegroups.com> |
On 25.03.2015 01:09, Julio Di Egidio wrote: > On Tuesday, March 24, 2015 at 7:12:17 PM UTC, Justin Marshall wrote: > >> Well we eventually identified root cause, it was in a completely unrelated section of code (error notification). it appears the SMTP class requires that you explicitly close the attachments once you are done, if you don't it will hang onto them indefinitely even after the class that instantiated them terminates. > > In .NET 4, SmtpClient, AttachmentBase, MailMessage, and other classes from the System.Net.Mail namespace implement the IDisposable interface (check the docs). To correctly use classes that implement IDisposable, you should use the "disposable patter" (the using statement), and, if appropriate, you can encapsulate the whole thing in a custom class of yours that itself implements IDisposable. > > HTH, > > Julio > Julio, you are blind, you are a moron, that's not how it works!
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
c# .net 4 unable to move file - file in use by another process (by itself) lachlann@gmail.com - 2014-10-16 08:08 -0700
Re: c# .net 4 unable to move file - file in use by another process (by itself) Kaz Kylheku <kaz@kylheku.com> - 2014-10-16 15:41 +0000
Re: c# .net 4 unable to move file - file in use by another process (by itself) lachlann@gmail.com - 2014-10-16 12:59 -0700
Re: c# .net 4 unable to move file - file in use by another process (by itself) Justin Marshall <lachlann@gmail.com> - 2015-03-24 12:12 -0700
Re: c# .net 4 unable to move file - file in use by another process (by itself) CarolHudson <CarolHudson0@yahoo.com> - 2015-04-22 21:05 +0200
Re: c# .net 4 unable to move file - file in use by another process (by itself) Queego <tonyhecht@gmail.com> - 2015-08-14 19:14 -0500
csiph-web