Click here to Skip to main content
15,920,111 members
Home / Discussions / C#
   

C#

 
GeneralLoosing focus Pin
Anonymous23-Jun-04 8:17
Anonymous23-Jun-04 8:17 
QuestionWhere is the rest of my Datagrid? Pin
kornstyle23-Jun-04 8:05
kornstyle23-Jun-04 8:05 
AnswerRe: Where is the rest of my Datagrid? Pin
Heath Stewart23-Jun-04 9:02
protectorHeath Stewart23-Jun-04 9:02 
GeneralRe: Where is the rest of my Datagrid? Pin
kornstyle23-Jun-04 9:17
kornstyle23-Jun-04 9:17 
GeneralRe: Where is the rest of my Datagrid? Pin
Heath Stewart23-Jun-04 10:32
protectorHeath Stewart23-Jun-04 10:32 
GeneralCode Critique Requested Pin
mealnumberone23-Jun-04 7:49
mealnumberone23-Jun-04 7:49 
GeneralRe: Code Critique Requested Pin
Daniel Turini23-Jun-04 8:38
Daniel Turini23-Jun-04 8:38 
GeneralRe: Code Critique Requested Pin
Heath Stewart23-Jun-04 8:50
protectorHeath Stewart23-Jun-04 8:50 
Actually, calling Dispose on an IDisposable implementation isn't always necessary. As you said, if you don't, it could kill scalability.

Disposing objects accomplishes two things (well, depending on implementation, but here's what supposed to happen): close/free native resources, and possibly close/free managed resources. It's when classes use native resources (like the FileStream) that disposing becomes necessary (otherwise you get memory leaks). Disposing completely managed resources cleans-up the object immediately and typically surpresses finalization by the GC. It's this that can help scalability.

Still, though, it's typically a good idea to dispose disposable objects when you're finished with them regardless of what is necessary. The using block statement will do that, even in an exception is thrown inside the block:
using (FileStream file = new FileStream(...))
{
  file.Write(...);
}
BTW, Daniel, this is mostly an extension of your comment to the original poster - it's not really directed at you.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Code Critique Requested Pin
Daniel Turini23-Jun-04 9:00
Daniel Turini23-Jun-04 9:00 
GeneralRe: Code Critique Requested Pin
Heath Stewart23-Jun-04 9:06
protectorHeath Stewart23-Jun-04 9:06 
GeneralRe: Code Critique Requested Pin
mealnumberone23-Jun-04 9:11
mealnumberone23-Jun-04 9:11 
GeneralRe: Code Critique Requested Pin
Daniel Turini23-Jun-04 10:25
Daniel Turini23-Jun-04 10:25 
GeneralRe: Code Critique Requested Pin
Steven Campbell23-Jun-04 9:42
Steven Campbell23-Jun-04 9:42 
GeneralDataGrid and end edit Pin
cje23-Jun-04 6:44
cje23-Jun-04 6:44 
GeneralRe: DataGrid and end edit Pin
Heath Stewart23-Jun-04 8:40
protectorHeath Stewart23-Jun-04 8:40 
GeneralRe: DataGrid and end edit Pin
cje23-Jun-04 8:49
cje23-Jun-04 8:49 
GeneralRe: DataGrid and end edit Pin
Heath Stewart23-Jun-04 9:00
protectorHeath Stewart23-Jun-04 9:00 
GeneralRe: DataGrid and end edit Pin
cje23-Jun-04 9:04
cje23-Jun-04 9:04 
QuestionHow-to? Connect to remote pc over LAN connection ? Pin
Adel83k23-Jun-04 5:57
Adel83k23-Jun-04 5:57 
AnswerRe: How-to? Connect to remote pc over LAN connection ? Pin
eggie523-Jun-04 6:44
eggie523-Jun-04 6:44 
GeneralRe: How-to? Connect to remote pc over LAN connection ? Pin
Adel83k24-Jun-04 1:09
Adel83k24-Jun-04 1:09 
AnswerRe: How-to? Connect to remote pc over LAN connection ? Pin
Steven Campbell23-Jun-04 7:19
Steven Campbell23-Jun-04 7:19 
AnswerRe: How-to? Connect to remote pc over LAN connection ? Pin
sides_dale23-Jun-04 15:44
sides_dale23-Jun-04 15:44 
GeneralSuggestion Pin
vcorn23-Jun-04 5:23
vcorn23-Jun-04 5:23 
GeneralRe: Suggestion Pin
Werdna23-Jun-04 6:59
Werdna23-Jun-04 6:59 

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

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