Describe ways of cleaning up objects.
Answers were Sorted based on User's Feedback
Answer / anky
using the keyword Dispose, we can delete the objects!
| Is This Answer Correct ? | 11 Yes | 1 No |
Answer / sugumar.r
Actually, there are two ways resources can be cleaned up
from our application.( Garbage Collection)
1. Dispose()- By default system will release all non
referenced variables from memeory.
2.Finalize()- We can explicitly perform Cleaning process
using Finalize method(Destructor)
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / vaidyanathan
By Dispose() method the object is marked for garbage
collection. But user can define a Dispose() method
identified by GC, only when the user implements the
IDisposable interface in the class. Once the dispose()
marks the object for deletion, the garbage collector, in
its subsequent collection cycle, collects the objects by
calling the respective Finalize() methods. So there is no
need for the user to write the Finalize() method. This is
the normal Process of Garbage collection.
At extreme cases user can force the garbage collection at a
specific time by calling GC.Collect() method. This should
be followed by GC.SuppressFinalize() method call to avoid
GC from calling Finalize() method on the same object once
again.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / subramanyam
in dotnet garbage collector automatically deletes the
object that is no more referenced
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / vinay tiwari
//we can perform this job with the help of destructor
using System;
class a
{
public int x;
public a(int b)
{
x=b;
}
public void display()
{
Console.WriteLine(x);
}
~a()
{
Console.Write("destroying object which is
created by a()");
}
}
class b
{
static void Main(string [] args)
{
a ob =new a(5);
ob.display();
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / mr. d
Using Dispose() method releases all the resources and memory
occupied by that object.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ashok
using the keyword NOTHING we can destroy the objects.
| Is This Answer Correct ? | 1 Yes | 7 No |
Define a manifest in .net?
What is the purpose of dictionary in c#?
Is c# queue thread safe?
Define clr in .net?
How to authenticate web service? When you enter the web service url in browser it should ask username and password. After entering the un&pwd we have to show its methods and service description(wsdl).
What is Named parameter in C#?
if a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Which namespaces are necessary to create a localized application?
What is a singleton unity?
Explain the process of abstraction with an example?
What is console based application?
what is the purpose of interface in c#.net
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)