Generic Dispose Function?
From: Jeff (a_at_a.com)
Date: 03/22/04
- Next message: JollyK: "COM+ constructor question"
- Previous message: Neil Allen: "Re: Does RSM is supported by the .NET Framework?"
- Next in thread: Jochen Kalmbach: "Re: Generic Dispose Function?"
- Reply: Jochen Kalmbach: "Re: Generic Dispose Function?"
- Reply: Jon Skeet [C# MVP]: "Re: Generic Dispose Function?"
- Reply: TT (Tom Tempelaere): "RE: Generic Dispose Function?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Mar 2004 07:12:59 -0700
In C++ I used to declare the following macro for deleteing objects:
#define SAFEDELETE(x) if(x != NULL) { delete x; x = NULL; }
Is there currently a way to do something similar to this in C#?
I'm constantly writing...
if(x != null)
{
x.Dispose();
x = null;
}
and would love to just write something like...
SAFEDISPOSE(x);
Thanks for your help!
- Next message: JollyK: "COM+ constructor question"
- Previous message: Neil Allen: "Re: Does RSM is supported by the .NET Framework?"
- Next in thread: Jochen Kalmbach: "Re: Generic Dispose Function?"
- Reply: Jochen Kalmbach: "Re: Generic Dispose Function?"
- Reply: Jon Skeet [C# MVP]: "Re: Generic Dispose Function?"
- Reply: TT (Tom Tempelaere): "RE: Generic Dispose Function?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|