Re: Is this not plain wrong, BinaryFormatter
From: Alexander Muylaert (Remove_amg_at_pandora.be)
Date: 06/07/04
- Next message: SKG: "HTML Parsing"
- Previous message: M: "Localization ?"
- In reply to: Jon Skeet [C# MVP]: "Re: Is this not plain wrong, BinaryFormatter"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: Is this not plain wrong, BinaryFormatter"
- Reply: Daniel O'Connell [C# MVP]: "Re: Is this not plain wrong, BinaryFormatter"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Jun 2004 21:28:01 +0200
So...
Two possible fixes for me.
* I write my own BinaryWriter. (with normal behaviour)
* I pass the writer as a Parameter
Both sollutions suck. The first gives me a ton of extra work. The second
is even worse, by passing the writer as a parameter, I need to use the
writer to stream something. Wich perhaps I don't want, or I should access
the BaseStream property. But ...
Hmmm
Who's idea was this and what was (s)he thinking...
Rule n°1: Free whatever you create (even with GC this one applies, I adore
the "using" statement)
Rule n°2: Don't free something that you didn't create.
Rule n°3: First create the object, next Implement the dispose, third
implement the thing inbetween.
Even when you have no GC the above to rules will prevent all leaks and null
pointer exceptions. One should only apply these three very simple rules,
extremely strictly. No buts... :-)
Imho this has nothing to do with GC, closing the stream is just a bad idea
and makes the binarywriter less interesting for me. Especially in the
situation I mentioned. And trust me, this happens a lot.
Kind regards
Alexander
- Next message: SKG: "HTML Parsing"
- Previous message: M: "Localization ?"
- In reply to: Jon Skeet [C# MVP]: "Re: Is this not plain wrong, BinaryFormatter"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: Is this not plain wrong, BinaryFormatter"
- Reply: Daniel O'Connell [C# MVP]: "Re: Is this not plain wrong, BinaryFormatter"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|