PC Review


Reply
Thread Tools Rate Thread

Dispose Pattern -- why void Dispose() is nonvirtual?

 
 
gz
Guest
Posts: n/a
 
      24th Jan 2008
Hi,

Does anyone know the reason?

Thanks,
gz
 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      24th Jan 2008
gz <(E-Mail Removed)> wrote:
> Does anyone know the reason?


Once you've got a virtual Dispose(bool) method, there's no need for the
normal Dispose to remain virtual, and keeping it so could lead to
inappropriate implementations which didn't call base.Dispose() - or
which called Dispose(bool) themselves as well as base.Dispose().

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
 
Reply With Quote
 
gz
Guest
Posts: n/a
 
      24th Jan 2008
On Jan 24, 1:28*pm, Jon Skeet [C# MVP] <sk...@pobox.com> wrote:
> gz <zyzhu2...@gmail.com> wrote:
> > Does anyone know the reason?

>
> Once you've got a virtual Dispose(bool) method, there's no need for the
> normal Dispose to remain virtual, and keeping it so could lead to
> inappropriate implementations which didn't call base.Dispose() - or
> which called Dispose(bool) themselves as well as base.Dispose().
>
> --
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet* Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk


I see. Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
On C# Dispose Pattern NvrBst Microsoft C# .NET 2 17th Feb 2010 02:38 PM
Dispose and Singleton Pattern =?Utf-8?B?SlQ=?= Microsoft Dot NET Framework 8 22nd Nov 2007 05:27 PM
Dispose pattern Thore Berntsen Microsoft C# .NET 25 5th Jun 2007 06:33 PM
Re: Dispose pattern in ASP.NET pages Phil Winstanley [Microsoft MVP] Microsoft ASP .NET 0 15th May 2004 04:33 PM
Dispose pattern in ASP.NET pages mircu Microsoft ASP .NET 9 15th May 2004 08:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:56 PM.