Sei sulla pagina 1di 2

C#.

Net
What is the difference between Finalize() and Dispose()?
Dispose() is called by as an indication for an object to release any unmanaged resources it has held. Finalize() is used for the same purpose as dispose however finalize doesnt assure the garbage collection of an object. Dispose() operates determinalistically due to which it is generally preferred.

How does the XmlSerializer work? What ACL permissions does a process using it require?
The XmlSerializer constructor generates a pair of classes derived from XmlSerializationReader and XmlSerializationWriter by analysis of the classes using reflection. Temporary C# files are created and compiled into a temporary assembly and then loaded into a process. The XmlSerializer caches the temporary assemblies on a per-type basis as the code generated like this is expensive. This cached assembly is used after a class is created Therefore the XmlSerialize requires full permissions on the temporary directory which is a user profile temp directory for windows applications.

What are circular references? Explain how garbage collection deals with circular references.
A circular reference is a run-around wherein the 2 or more resources are interdependent on each other rendering the entire chain of references to be unusable. There are quite a few ways of handling the problem of detecting and collecting cyclic references. 1. A system may explicitly forbid reference cycles. 2. Systems at times ignore cycles when they have short lives and a small amount of cyclic garbage. In this case a methodology of avoiding cyclic data structures is applied at the expense of efficiency. 3. Another solution is to periodically use a tracing garbage collector cycles. Other types of methods to deal with cyclic references are: Weighted reference counting Indirect reference counting

What are Extender provider components? Explain how to use an extender provider in the project.
An extender provider is a component that provides properties to other components. Implementing an extender provider:

Use the ProvidePropertyAttribute, which specifies the name of the property that an implementer of IExtenderProvider provides to other components, attribute to specify the property provided by your extender provider. Implement the provided property. Track which controls receive your provided property. Implement the IExtenderProvider, which defines the interface for extending properties to other components in a containe, interface.

What is the difference between Debug.Write and Trace.Write? When should each be used?
Debug.Write: Debug Mode, Release Mode (used while debuging a project) Trace.write: Release Mode (used in Released verion of Applications)

Explain the use of virtual, sealed, override, and abstract.


The virtual keyword enables a class to be overridden. If it has to be prevented from being overridden, then the sealed keyword needs to be used. If the keyword virtual is not used, members of the class can even then be overridden. However, its usage is advised for making the code meaningful. The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly. An abstract virtual method means that the definition of the method needs to be given in the derived class.

Potrebbero piacerti anche