Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #5410

Re: c# .net 4 unable to move file - file in use by another process (by itself)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.killfile.org!.POSTED!not-for-mail
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 Wed, 22 Apr 2015 21:05:16 +0200
Organization Killfiles, Unlimited
Lines 12
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>
NNTP-Posting-Host p5b342eaa.dip0.t-ipconnect.de
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Trace flea.killfile.org 1429729516 29935 91.52.46.170 (22 Apr 2015 19:05:16 GMT)
X-Complaints-To news@usenet.killfile.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0
In-Reply-To <e9bfb46e-f63f-4d61-931d-7b2765439841@googlegroups.com>
Xref csiph.com comp.programming:5410

Show key headers only | View raw


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


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