Chapter 4

 < Day Day Up > 

A1:

The advantages of a class factory pattern are that it can control the number of objects created, encapsulates the logic required to create an object, and makes it easier to add new products by isolating the code in the factory.

A2:

Custom exceptions should inherit from the ApplicationException class. Three constructors should be included: a parameterless one, a constructor accepting a string parameter, and a constructor that accepts a string and Exception object parameter.

A3:

System.Object.Equals bases equality on objects having the same memory location.

A4:

A class must implement the IEnumerable and IEnumerator interfaces to support the foreach statement.

A5:

Generics permit a collection to be type-safe. This means the collection class is restricted to holding and processing objects of one type. Non-generic collections can hold any mixture of objects and require casting to detect their type.

A6:

The IDisposable interface is a convenient way to notify a client that an object's Dispose method should be called. The client only needs to check for the existence of the interface.

A7:

  1.  false 

  2.  true 

  3.  false 

  4.  true 

The Clone method creates a copy of an object at a new address.

A8:

Objects with a Finalize method implemented are placed in a special queue so that Finalize can be executed before Garbage Collection occurs. This delays the actual Garbage Collection by one cycle.

     < Day Day Up > 


    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net