Click here to Skip to main content
16,004,944 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dangerous error with Directory.Delete(string, bool) Pin
Paul Conrad23-Sep-07 9:44
professionalPaul Conrad23-Sep-07 9:44 
GeneralRe: Dangerous error with Directory.Delete(string, bool) Pin
Scott Dorman23-Sep-07 9:48
professionalScott Dorman23-Sep-07 9:48 
GeneralRe: Dangerous error with Directory.Delete(string, bool) Pin
Paul Conrad23-Sep-07 10:36
professionalPaul Conrad23-Sep-07 10:36 
QuestionC# certification Pin
samymoenis23-Sep-07 3:35
samymoenis23-Sep-07 3:35 
AnswerRe: C# certification Pin
Scott Dorman23-Sep-07 4:13
professionalScott Dorman23-Sep-07 4:13 
AnswerRe: C# certification Pin
brucedkyle23-Sep-07 13:17
brucedkyle23-Sep-07 13:17 
Questioncouple of questions Pin
kalyan_241623-Sep-07 3:29
kalyan_241623-Sep-07 3:29 
AnswerRe: couple of questions Pin
Scott Dorman23-Sep-07 4:08
professionalScott Dorman23-Sep-07 4:08 
Since you are asking this in the C# forum, I'm going to assume you want to know specifically about C#.

kalyan_2416 wrote:
1) i want to know more difference between destructor and dispose method.
if u have any articles please let me know


First, take a look at this article[^]. It will give you an explanation of the IDisposable interface and the Dispose method.

C# does not have a destructor like C++ does. It does, however, have a finalizer which is defined using the same syntax as a C++ destructor, namely the ~T syntax (where T is the name of the class).

The Dispose method is described by the IDisposable interface and is used primarily when an object mantains unmanaged memory. It provides a way for the caller to explicitly indicate that it is done using that object and that it is safe to cleanup managed or unmanaged resources. Internally, the Dispose method knows how to cleanup those unmanaged resources. This is important because the GC in .NET doesn't know any thing about what to do with these unmanaged resources.

A finalizer is a "special" function that helps guarantee that the object will be properly cleaned up. That being said, there are very few times when you should implement a finalizer as there are a lot of specific rules that apply in order to get them right.

kalyan_2416 wrote:
2) Base b=new Derived()
derived d=new Base()
which one is illegal and why


Which one do you think is illegal? Have you tried to create this code in Visual Studio? If you think about what you are trying to accomplish with this bit of code and understand what the names mean it should become very clear. If you think of derivation as a tree structure, the child classes derive from the base class, with each child class becoming increasingly more specialized the further away from the base class they are.


Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

QuestionRead Excel by Oledb Pin
Rami Said Abd Alhalim23-Sep-07 2:18
Rami Said Abd Alhalim23-Sep-07 2:18 
AnswerRe: Read Excel by Oledb Pin
Paul Conrad23-Sep-07 5:53
professionalPaul Conrad23-Sep-07 5:53 
Questionconsole apllication send mail in c sharp vs 2005 Pin
zafax_23-Sep-07 1:58
zafax_23-Sep-07 1:58 
AnswerRe: console apllication send mail in c sharp vs 2005 Pin
Kristian Sixhøj23-Sep-07 2:11
Kristian Sixhøj23-Sep-07 2:11 
GeneralRe: console apllication send mail in c sharp vs 2005 Pin
zafax_23-Sep-07 4:38
zafax_23-Sep-07 4:38 
AnswerRe: console apllication send mail in c sharp vs 2005 Pin
martin_hughes23-Sep-07 2:15
martin_hughes23-Sep-07 2:15 
GeneralRe: console apllication send mail in c sharp vs 2005 Pin
zafax_23-Sep-07 4:34
zafax_23-Sep-07 4:34 
Questionconsole in c sharp Pin
zafax_22-Sep-07 23:05
zafax_22-Sep-07 23:05 
AnswerRe: console in c sharp [modified] Pin
Kristian Sixhøj22-Sep-07 23:30
Kristian Sixhøj22-Sep-07 23:30 
GeneralRe: console in c sharp Pin
zafax_23-Sep-07 0:13
zafax_23-Sep-07 0:13 
GeneralRe: console in c sharp Pin
Kristian Sixhøj23-Sep-07 0:20
Kristian Sixhøj23-Sep-07 0:20 
GeneralRe: console in c sharp Pin
zafax_23-Sep-07 0:56
zafax_23-Sep-07 0:56 
GeneralRe: console in c sharp Pin
Kristian Sixhøj23-Sep-07 0:57
Kristian Sixhøj23-Sep-07 0:57 
GeneralRe: console in c sharp Pin
Kristian Sixhøj23-Sep-07 0:32
Kristian Sixhøj23-Sep-07 0:32 
AnswerRe: console in c sharp Pin
Guffa22-Sep-07 23:44
Guffa22-Sep-07 23:44 
GeneralRe: console in c sharp Pin
zafax_22-Sep-07 23:52
zafax_22-Sep-07 23:52 
AnswerRe: console in c sharp Pin
Guffa23-Sep-07 0:36
Guffa23-Sep-07 0:36 

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.