Click here to Skip to main content
15,915,603 members
Home / Discussions / C#
   

C#

 
GeneralRe: The C# using operator Pin
Chris Maunder1-Jul-02 16:25
cofounderChris Maunder1-Jul-02 16:25 
GeneralRe: The C# using operator Pin
Rama Krishna Vavilala1-Jul-02 16:03
Rama Krishna Vavilala1-Jul-02 16:03 
GeneralRe: The C# using operator Pin
Nish Nishant1-Jul-02 16:08
sitebuilderNish Nishant1-Jul-02 16:08 
GeneralRe: The C# using operator Pin
Andy Smith1-Jul-02 16:12
Andy Smith1-Jul-02 16:12 
GeneralRe: The C# using operator Pin
Nish Nishant1-Jul-02 17:15
sitebuilderNish Nishant1-Jul-02 17:15 
GeneralRe: The C# using operator Pin
Andy Smith1-Jul-02 17:28
Andy Smith1-Jul-02 17:28 
GeneralRe: The C# using operator Pin
Rama Krishna Vavilala1-Jul-02 16:17
Rama Krishna Vavilala1-Jul-02 16:17 
GeneralRe: The C# using operator Pin
James T. Johnson1-Jul-02 17:15
James T. Johnson1-Jul-02 17:15 
You pretty much summarized the reason to explicitly call Dispose on objects that implement it Smile | :)

One thing I noticed though; was you said it can make the code ugly if you have multiple objects to call dispose on; you can simplify it; if they are in one block.

Font f = ....;
Brush br = ....;
Bitmap bi = ....;

try
{
  .....
}
finally
{
  f.Dispose();
  br.Dispose();
  bi.Dispose();
}
Could become
using(Font f = ....)
using(Brush br = ....)
using(Bitmap bi = ....)
{
  .....
}
Which is much much cleaner than the mass indentation you would get otherwise. Smile | :)

James
"Java is free - and worth every penny." - Christian Graus
GeneralRe: The C# using operator Pin
Rama Krishna Vavilala6-Jul-02 16:06
Rama Krishna Vavilala6-Jul-02 16:06 
GeneralRe: The C# using operator Pin
Andy Smith1-Jul-02 16:15
Andy Smith1-Jul-02 16:15 
GeneralRe: The C# using operator Pin
Rama Krishna Vavilala1-Jul-02 16:25
Rama Krishna Vavilala1-Jul-02 16:25 
GeneralRe: The C# using operator Pin
Andy Smith1-Jul-02 16:29
Andy Smith1-Jul-02 16:29 
GeneralRe: The C# using operator Pin
Rama Krishna Vavilala1-Jul-02 16:32
Rama Krishna Vavilala1-Jul-02 16:32 
GeneralRe: The C# using operator Pin
James T. Johnson1-Jul-02 17:25
James T. Johnson1-Jul-02 17:25 
GeneralRe: The C# using operator Pin
Andy Smith1-Jul-02 17:30
Andy Smith1-Jul-02 17:30 
GeneralRe: The C# using operator Pin
Nish Nishant1-Jul-02 16:05
sitebuilderNish Nishant1-Jul-02 16:05 
GeneralRe: The C# using operator (stupid question #2) Pin
leppie2-Jul-02 7:36
leppie2-Jul-02 7:36 
GeneralRe: The C# using operator (stupid question #2) Pin
Andy Smith2-Jul-02 7:52
Andy Smith2-Jul-02 7:52 
GeneralRe: The C# using operator (stupid question #2) Pin
leppie3-Jul-02 5:17
leppie3-Jul-02 5:17 
GeneralUsing OpenGL with C# Pin
Ilan Ehrenfeld30-Jun-02 23:51
Ilan Ehrenfeld30-Jun-02 23:51 
GeneralRe: Using OpenGL with C# Pin
Nick Parker1-Jul-02 18:23
protectorNick Parker1-Jul-02 18:23 
GeneralRe: Using OpenGL with C# Pin
James T. Johnson1-Jul-02 18:38
James T. Johnson1-Jul-02 18:38 
GeneralFWD: TcpListener.AcceptTcpClient query Pin
Nish Nishant30-Jun-02 21:34
sitebuilderNish Nishant30-Jun-02 21:34 
GeneralRecommendations for container and algorithm library. Pin
30-Jun-02 18:53
suss30-Jun-02 18:53 
GeneralRe: Recommendations for container and algorithm library. Pin
Christian Graus30-Jun-02 19:01
protectorChristian Graus30-Jun-02 19:01 

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.