.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> ASP.Net >> Post New Question Subscribe to Interview Questions

I thought destructors didn't exist in C#.Why can I declare one?

Posted By :Shashi Ray     Posted Date :March 30, 2009    Points :10   Category :ASP.Net 
You can declare a method that looks like a C++ destructor such as ~Employee(). But it really becomes a shorthand way to define System.Object.Finalize.The Finalize method is not the same as a C++ destructor.A short explanation is that C++ destructors are called when the call stack unwinds.The Finalize method will be called when the garbage collector of the CLR is ready to destroy the object.

You can also find related Interview Question to I thought destructors didn''t exist in C#.Why can I declare one?  below: 

When do you have to declare a class as abstract?

  
1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
2. When at least one of the methods in the class is abstract. (More...)

Can you declare an override method to be static if the original method is not static?

  
No. The signature of the virtual method must remain the same.
(Note: Only the keyword virtual is changed to keyword override). (More...)

I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?

  
You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i; foo(out i); where foo is declared as follows: [return-type] foo(out int o) { } (More...)

Why do I get an error (CS1006) when trying to declare a method without specifying a return type?

  
If you leave off the return type on a method declaration, the compiler thinks you are trying to declare a constructor. So if you are trying to declare a method that returns nothing, use void. The following is an example: // This results in a CS1006 error public static staticMethod (mainStatic obj) // This will work as wanted public static void staticMethod (mainStatic obj) (More...)

How do you declare 2 dimensional array in Javascript?

  
myarray[0][0]="Compaq 486"
myarray[0][1]="Compaq 586"
myarray[0][2]="Compaq 686"
myarray[1][0]="Dell 486"
myarray[1][1]="Dell 586"
myarray[1][2]="Dell 686"
myarray[2][0]="IBM 486"
myarray[2][1]="IBM 586"
myarray[2][2]="IBM 686" (More...)

More than one IDENTITY column per table can be exist in SQL Server . (True /False)

  
False.
There can only be one IDENTITY column per table in SQL Server.
Its auto Incremented Column defined by the user. (More...)

Can you declare the override method static while the original method is non-static?

  
No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override. (More...)

How to declare an array for int?

  
int[] n;
Here,
int -- Data Type
[] -- Name of the Array
n -- name

(More...)

Can we declare variables with xml data type?

  
Yes, variables can be declared of xml data type that can hold xml data (More...)

Can we declare column with xml data type to hold xml data?

  
Yes, A column with xml data type can be declared. (More...)

how can you identify the .net framework exist on a machine?

  
Presence of MSCorEE.dll file in
the %SystemRoot%\system32 directory.

The existence of above mentioned dll file tells you that the .NET
Framework is installed (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend