Click here to Skip to main content
       

C#

 
AnswerRe: dispose (always?) PinmvpOriginalGriff5-Aug-12 22:18 
AnswerRe: dispose (always?) PinmemberBobJanova5-Aug-12 23:49 
GeneralRe: dispose (always?) PinmemberPIEBALDconsult6-Aug-12 3:50 
GeneralRe: dispose (always?) PinmemberBobJanova7-Aug-12 0:26 
GeneralRe: dispose (always?) PinmemberPIEBALDconsult7-Aug-12 3:36 
GeneralRe: dispose (always?) Pinmemberthewazz7-Aug-12 4:58 
GeneralRe: dispose (always?) PinprotectorPete O'Hanlon7-Aug-12 23:43 
GeneralRe: dispose (always?) Pinmemberjschell10-Aug-12 12:42 
PIEBALDconsult wrote:
So you can hold onto a Connection for a long time and only open it when you need it.

 
True but in normal practice that shouldn't happen.
 
First the significance in the object is the connection. If there is no connection then the object itself is light weight so creation itself isn't doing anything (again for most situations.)
 
Second if you keep it around you must explicitly manage the state. So to reuse it you would need to either explicitly check the state or implicitly assume the state is correct. The first case requires additional code and the second leads to complexity as the maintenance engineer would need to insure correct state. Both of those cases are more easily solved by using creation.
GeneralRe: dispose (always?) PinmemberPIEBALDconsult10-Aug-12 13:38 
GeneralRe: dispose (always?) Pinmemberjschell11-Aug-12 7:28 
GeneralRe: dispose (always?) PinmemberPIEBALDconsult11-Aug-12 12:05 
QuestionC# setup and deployment projects Pinmemberzead4-Aug-12 3:26 
AnswerRe: C# setup and deployment projects Pinmemberjschell4-Aug-12 7:00 
QuestionRe: C# setup and deployment projects Pinmemberzead4-Aug-12 20:12 
AnswerRe: C# setup and deployment projects Pinmemberjschell5-Aug-12 7:26 
AnswerRe: C# setup and deployment projects PinmemberPaul Conrad4-Aug-12 11:47 
AnswerRe: C# setup and deployment projects PinmemberBernhard Hiller5-Aug-12 22:26 
GeneralRe: C# setup and deployment projects Pinmemberzead7-Aug-12 20:52 
AnswerRe: C# setup and deployment projects PinmemberMember 451899226-Aug-12 22:12 
QuestionC# window form Pinmemberyashdiljale4-Aug-12 1:19 
AnswerRe: C# window form PinprotectorPete O'Hanlon4-Aug-12 2:41 
AnswerRe: C# window form PinmvpOriginalGriff4-Aug-12 3:45 
AnswerRe: C# window form PinmemberBillWoodruff4-Aug-12 4:40 
AnswerRe: C# window form PinmemberChristian Amado6-Aug-12 10:29 
AnswerRe: C# window form PinmemberMember 451899226-Aug-12 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.140922.1 | Last Updated 23 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid