Click here to Skip to main content
15,913,212 members
Home / Discussions / C#
   

C#

 
GeneralRe: Implementing IDisposable in Sealed class Pin
Pete O'Hanlon17-Aug-08 8:50
mvePete O'Hanlon17-Aug-08 8:50 
JokeRe: Implementing IDisposable in Sealed class Pin
Paul Conrad17-Aug-08 9:45
professionalPaul Conrad17-Aug-08 9:45 
GeneralRe: Implementing IDisposable in Sealed class Pin
Scott Dorman17-Aug-08 17:54
professionalScott Dorman17-Aug-08 17:54 
GeneralRe: Implementing IDisposable in Sealed class Pin
Scott Dorman17-Aug-08 17:51
professionalScott Dorman17-Aug-08 17:51 
GeneralRe: Implementing IDisposable in Sealed class Pin
N a v a n e e t h17-Aug-08 4:27
N a v a n e e t h17-Aug-08 4:27 
GeneralRe: Implementing IDisposable in Sealed class Pin
Blumen17-Aug-08 4:32
Blumen17-Aug-08 4:32 
GeneralRe: Implementing IDisposable in Sealed class Pin
Scott Dorman17-Aug-08 17:49
professionalScott Dorman17-Aug-08 17:49 
AnswerRe: Implementing IDisposable in Sealed class Pin
Scott Dorman17-Aug-08 17:48
professionalScott Dorman17-Aug-08 17:48 
The code you show doesn't match your error message. Your code does not show the CustomerDal as a sealed class.

For more information on the Dispose pattern, check out this article[^].

If you are going to seal the class, then you can't declare protected methods (or properties). Sealing tells the compiler that nothing can inherit from that class; since protected means that only that class and any derived class can access it, protected methods are effectively useless. As Colin pointed out, making the method private would work.

If you really want to seal your class, then you only need to implement the IDisposable interface, not the full Dispose pattern. In your sample code, the logic you have in the Dispose(bool) method would simply go in the Dispose() method, which would be the only method you need to implement.

Scott Dorman
Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA

[Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

GeneralRe: Implementing IDisposable in Sealed class Pin
Blumen18-Aug-08 0:55
Blumen18-Aug-08 0:55 
GeneralRe: Implementing IDisposable in Sealed class Pin
Pete O'Hanlon18-Aug-08 2:41
mvePete O'Hanlon18-Aug-08 2:41 
GeneralRe: Implementing IDisposable in Sealed class Pin
Blumen18-Aug-08 18:45
Blumen18-Aug-08 18:45 
QuestionHow to know wheter a string contains a url? Pin
Waleed Eissa16-Aug-08 23:54
Waleed Eissa16-Aug-08 23:54 
AnswerRe: How to know wheter a string contains a url? Pin
Manas Bhardwaj17-Aug-08 0:04
professionalManas Bhardwaj17-Aug-08 0:04 
GeneralRe: How to know wheter a string contains a url? Pin
Waleed Eissa17-Aug-08 1:37
Waleed Eissa17-Aug-08 1:37 
AnswerRe: How to know wheter a string contains a url? Pin
Christian Graus17-Aug-08 0:52
protectorChristian Graus17-Aug-08 0:52 
GeneralRe: How to know wheter a string contains a url? Pin
Waleed Eissa17-Aug-08 1:42
Waleed Eissa17-Aug-08 1:42 
GeneralRe: How to know wheter a string contains a url? Pin
Christian Graus17-Aug-08 2:06
protectorChristian Graus17-Aug-08 2:06 
GeneralRe: How to know wheter a string contains a url? [modified] Pin
Waleed Eissa17-Aug-08 3:34
Waleed Eissa17-Aug-08 3:34 
GeneralRe: How to know wheter a string contains a url? Pin
Manas Bhardwaj18-Aug-08 6:15
professionalManas Bhardwaj18-Aug-08 6:15 
GeneralRe: How to know wheter a string contains a url? Pin
Waleed Eissa18-Aug-08 13:49
Waleed Eissa18-Aug-08 13:49 
AnswerRe: How to know wheter a string contains a url? Pin
Paul Conrad17-Aug-08 8:12
professionalPaul Conrad17-Aug-08 8:12 
GeneralRe: How to know wheter a string contains a url? Pin
Waleed Eissa17-Aug-08 17:31
Waleed Eissa17-Aug-08 17:31 
QuestionNew Extention Pin
hadad16-Aug-08 22:15
hadad16-Aug-08 22:15 
AnswerRe: New Extention Pin
Wendelius16-Aug-08 23:12
mentorWendelius16-Aug-08 23:12 
GeneralRe: New Extention Pin
hadad16-Aug-08 23:19
hadad16-Aug-08 23:19 

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.