You work as the application developer at Certkiller .com.
You create a new class that
uses unmanaged resources, but which still has references to
managed resources on
other objects.
You want users of the new class to be able to explicitly
release resources when the
class instance is no longer required.
What should you do next?
Choose the three actions which you should perform. Each
correct answer presents
only part of the complete solution.



You work as the application developer at Certkiller .com. You create a new class that uses unmanag..

Answer / gaaa

A. Define the existing class so that it inherits from the
WeakReference class.
B. Define the existing class so that it applies the
IDisposable interface.
C. Create a new class destructor which calls methods on
other objects to release the
managed resources.
D. Create a new class destructor that releases the unmanaged
resources.
E. Create a new Dispose method that calls System.GC.Collect
to force garbage
collection.
F. Create a new Dispose method that releases unmanaged
resources and which also calls
methods on other objects to release the managed resources.

Answer: B,D,F

Explanation:
It is necessary to implement the IDisposable interface if
you need to release unmanaged
resources or want explicit control of the life of managed
resources. A class destructor
should be created to release the unmanaged resources and
this should be called from within the Dispose method. The
dispose method should also release the managed
resources.
Inheriting from WeakReference would result in the garbage
collector releasing resources
even though there may be valid references.
The managed resources should be released in the Dispose method.
System.GC.Collect could be used, however it is more
efficient to manually release the
managed resources. The GC incurs overhead and may have only
recently been called
anyway. The question states resources should be released
explicitly.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Microsoft Certifications Interview Questions

What is a Console port and why is it used for and usually console is present in which Hardware devices ?

1 Answers  


• How do you view all the GCs in the forest? • Why not make all DCs in a large forest as GCs? • Trying to look at the Schema, how can I do that? • What are the Support Tools? Why do I need them? • What is LDP? What is REPLMON? What is ADSIEDIT? What is NETDOM? What is REPADMIN?

3 Answers  


Trying to look at the Schema, how can I do that?

2 Answers  


what is the function of DHCP?

17 Answers   Wipro, YTI,


• What is Active Directory? • What is LDAP? • Can you connect Active Directory to other 3rd-party Directory Services? Name a few options. • Where is the AD database held? What other folders are related to AD? • What is the SYSVOL folder? • Name the AD NCs and replication issues for each NC • What are application partitions? When do I use them • How do you create a new application partition • How do you view replication properties for AD partitions and DCs? • What is the Global Catalog?

5 Answers   HCL, PPTS, TCS,


Name three booting files?

8 Answers   HS, Wipro,


what is straight cabling and cross cabling and how can one differentiate whether it is straight cabling or Cross cabling?

1 Answers  


What is Domain Hosting?

2 Answers  


Which is best among dotnet and dotnet diploma? Friends Please answer this question as soon as possible.

0 Answers  


You work as the application developer at Certkiller .com. The global cache contains an assembly named Certkiller Ass10. You are busy working on an assembly named Certkiller Ass09. Certkiller Ass9 includes a public method. You want the public method to be called from only Certkiller Ass10. Choose the permission class which you should use.

1 Answers  


What is LDP? What is REPLMON? What is ADSIEDIT? What is NETDOM? What is REPADMIN?

1 Answers  


What are sites? What are they used for?

0 Answers   IBM, TCS, Wipro,


Categories
  • Cisco Certifications Interview Questions Cisco Certifications (2321)
  • Microsoft Certifications Interview Questions Microsoft Certifications (171)
  • Sun Certifications Interview Questions Sun Certifications (45)
  • CISA Certification Interview Questions CISA Certification (744)
  • Oracle Certifications Interview Questions Oracle Certifications (64)
  • ISTQB Certification Interview Questions ISTQB Certification (109)
  • Certifications AllOther Interview Questions Certifications AllOther (295)