Friday, September 26, 2008

ASP.NET6

>>Changes to which portion of version number indicates an incompatible change?
Major or minor. Changes to the major or minor portion of the version number indicate an
incompatible change. Under this convention then, version 2.0.0.0 would be considered incompatible
with version 1.0.0.0. Examples of an incompatible change would be a change to the types of some
method parameters or the removal of a type or method altogether. Build. The Build number is
typically used to distinguish between daily builds or smaller compatible releases. Revision.
Changes to the revision number are typically reserved for an incremental build needed to fix a
particular bug. You‘ll sometimes hear this referred to as the ”emergency bug fix” number in that
the revision is what is often changed when a fix to a specific bug is shipped to a customer.
>>What is side-by-side execution?
           Can two application one using private assembly and other using 
>>Shared assembly be stated as a side-by-side executables?
Side-by-side execution is the ability to run multiple versions of an application or component on
the same computer. You can have multiple versions of the common language runtime, and multiple
versions of applications and components that use a version of the runtime, on the same computer at
the same time. Since versioning is only applied to shared assemblies, and
not to private assemblies, two application one using private assembly and one using shared assembly
cannot be stated as side-by-side
executables.
>>Why string are called Immutable data Type ?
The memory representation of string is an Array of Characters, So on re-assigning the new array of
Char is formed a the start address is changed . Thus keeping the Old string in Memory for Garbage
Collector to be disposed.

>>What does assert() method do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error
dialog if the condition is false. The program proceeds without any interruption if the condition is
true.

>>What‘s the difference between the Debug class and Trace class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and
release builds.

>>Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose. For applications that are constantly running you run the
risk of overloading the machine and the hard drive. Five levels range from None to Verbose,
allowing you to fine-tune the tracing activities.

>>Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.

>>How do assemblies find each other?
By searching directory paths. There are several factors which can affect the path (such as the
AppDomain host, and application configuration files), but for private assemblies the search path is
normally the application‘s directory and its sub-directories. For shared assemblies, the search
path is normally same as the private assembly path plus the shared assembly cache.

>>How does assembly versioning work?
Each assembly has a version number called the compatibility version. Also each reference to an
assembly (from another assembly) includes both the name and version of the referenced assembly.The
version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two
parts different are normally viewed as incompatible. If the first two parts are the same, but the
third is different, the assemblies are deemed as ‘maybe compatible‘. If only the fourth part is
different, the assemblies are deemed compatible. However, this is just the default guideline - it
is the version policy that decides to what extent these rules are enforced. The version policy can
be specified via the application configuration file.

>>What is an Application Domain?
An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a
Win32 process. The primary purpose of the AppDomain is to isolate an application from other
applications. Win32 processes provide isolation by having distinct memory address spaces. This is
effective, but it is expensive and doesn‘t scale well. The .NET runtime enforces AppDomain
isolation by keeping control over the use of memory - all memory in the AppDomain is managed by the
.NET runtime, so the runtime can ensure that AppDomains do not access each other‘s memory.

>>What is garbage collection?
Garbage collection is a system whereby a run-time component takes responsibility for managing the
lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java
and many other languages/runtimes have used garbage collection for some time.

>>Why doesn‘t the .NET runtime offer deterministic destruction?
Because of the garbage collection algorithm. The .NET garbage collector works by periodically
running through a list of all the objects that are currently being referenced by an application.
All the objects that it doesn’t find during this search are ready to be destroyed and the memory
reclaimed. The implication of this algorithm is that the runtime doesn’t get notified
immediately when the final reference on an object goes away - it only finds out during the next
sweep of the heap.
Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely
as possible. Normally heap exhaustion is the trigger for a collection sweep.

>>Is the Lack of deterministic destruction in .NET a probLem?
lt’s certainly an issue that affects component design. lf you have objects that maintain expensive
or scarce resources (e.g. database locks), you need to provide some way for the client to tell the
object to release the resource when it is done. Microsoft recommend that you provide a method
called Dispose() for this purpose. However, this causes problems for distributed objects - in a
distributed system who calls the Dispose() method? Some form of reference-counting or
ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime
offers no help with this.
>>What is seriaLization?
Serialization is the process of converting an object into a stream of bytes. Deserialization is the
opposite process of creating an object from a stream of bytes. Serialization / Deserialization is
mostly used to transport objects (e.g. during remoting), or to persist
objects (e.g. to a file or database).
>>Does the .NET Framework have in-buiLt support for seriaLization?
There are two separate mechanisms provided by the .NET class library - XmlSerializer and
SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses
SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.

>>Can I customise the seriaLization process?
Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a
particular class. For example, a field or property can be marked with the [Xmllgnore] attribute to
exclude it from serialization. Another example is the [XmlElement]
attribute, which can be used to specify the XML element name to be used for a particular
property or field.
Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by
attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer’s
[Xmllgnore] attribute. Ultimate control of the serialization process can be acheived by
implementing the the lSerializable interface on the class whose instances are to be serialized.

>>Why is XmLSeriaLizer so sLow?
There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize
or deserialize an object of a given type in an application, there is a significant delay. This
normally doesn’t matter, but it may mean, for example, that XmlSerializer is a poor choice for
loading configuration settings during startup of a GUl application.

>>Why do I get errors when I try to seriaLize a HashtabLe?
XmlSerializer will refuse to serialize instances of any class that implements lDictionary, e.g.
Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.

>>What are attributes?
There are at least two types of .NET attribute. The first type l will refer to as a metadata
attribute - it allows some data to be attached to a class or method. This data becomes part of the
metadata for the class, and (like other class metadata) can be accessed via reflection.
The other type of attribute is a context attribute. Context attributes use a similar syntax to
metadata attributes but they are fundamentally different. Context attributes provide an
interception mechanism whereby instance activation and method calls can be





No comments: