What is .Net Framework?

  1. It is an environment for developing, building and executing desktop applications, web applications and web services.
  2. It provides a language-neutral development & execution environment
  3. It ensures that an application would not be able to access memory that is not authorized to access.
  4. It provides services to run “managed” applications.
  5. It handles the garbage collection.
  6. It provides different programming models for windows based application and web based applications.
  7. It provides an event driven programming model for building Windows device Drivers.
  8. It uses DCOM for making transaction between managed and unmanaged code.

What is CLR and the benefits of the CLR?

CLR is nothing but Common Language Runtime which provides the runtime environment for the managed code. This is the main part of the .Net Framework. The managed code will be executed under the CLR. The following are the benefits of the CLR.

  1. CLR is responsible for the type safety.
  2. It provides core services such as Memory management, thread management and remoting.
  3. CLR ensures that the application would not access the memory that is not authorized to access.
  4. It launches separate process for every application running under it.
  5. It will free the resources using Garbage Collection.

What is CTS?

CTS is nothing but Common Type System which provides the common data types that can be used by managed code. It facilitates the cross language integration, type safety and high performance code execution.

What is CLS?

CLS is nothing but the Common Language Specification which defines the rules and standards for the languages in order to compatible with other .Net languages. This enables the C# developers to inherirt from classes defined in VB.NET or other .Net Compatible languages.

What is Managed Code?

The .Net Framework provides a runtime environment called the Common Language Runtime, which manages the execution of the code and provides services that make the development process easier. Compilers and tools expose the run-time’s functionality and enable you to write code that benefits from this managed executon environment. The code that runs within the Common Language Runtime is called managed code.

What is MSIL?

When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code. MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.

What is JIT Compilation?

  1. JIT compiler compiles instructions into machine code at runtime.
  2. The Code compiler by the JIT compiler runs under CLR.
  3. The instructions compiled by JIT compilers are written in Native code.

What is Portable Execution?

PE is the file format defining the structure that all executable files(EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Object File Format (COFF). The  EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.

What is assembly?

It is the smallest deployable unit. Each assembly has only one entry point – Main(), WinMain() or DLLMain()

What are the contents of assembly?

A static assembly can consist of four elements:

  1. Assembly manifest - Contains the assembly metadata. An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types  and resources.
  2. Type metadata - Binary information that describes a program.
  3. Microsoft intermediate language (MSIL) code.

What is Metadata?

Metadata is a binary information that is stored in separate section of PE assembly. Every type and member defined in an assembly is described within metadata. Whne code is executed, the .Net runtime loads metadata in memory. The kind of information stored in metadata includes: Attributes of types, Name, Visibility, base class of types, member methods, member fields, properties..etc. Metadata allows self-describing files and allows for language independence and interoperability.

What are the different types of assembly?

A. Assemblies are three types.

  1. Private - installed in the installation directory of an application and is accessible to that application only.
  2. Shared or public - Shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.
  3. Satelite Assemblies - Often used to deploy language-specific resources for an application.

What is a dynamic assembly?

A dynamic assembly is created dynamically at run time when an application requires the types within these  assemblies.

What are the namespaces used to create the dynamic assembly?

System.CodeDom
System.Reflection.Emit

What is a strong name?

You need to assign a strong name to an assembly to place it in the GAC and make it globally accessible. A strong name consists of a name that consists of an assembly’s identity (text name, version number, and culture information), a  public key and a digital signature generated over the assembly. The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which allows verification and key pair and signature generation.

What is GAC? What are the steps to create an assembly and add it to the GAC?

The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
Steps

  1. Create a strong name using sn.exe tool eg: sn -k mykey.snk
  2. in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]
  3. recompile project, and then install it to GAC in two ways :
  4. drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
  5. gacutil -i abc.dll

What is the caspol.exe tool used for?

The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise  policy levels.

What is Ilasm.exe used for?

Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.

What is Ildasm.exe used for?

Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.

What is the ResGen.exe tool used for?

ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.

Which is the root of the .Net Framework type hierarchy?

System.Object

What is Application Domain?

Application domain is the boundary within which application runs. A process can contain multiple application domains.  Apllication domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use the proxy.

Does .net Framework release memory for unmanaged resources?

Unmanaged resources are outside the scope of .Net CLR. They must be cleaned up explicitly by the programmer. Opening Files, Netwrok Connections..etc are the examples for this. The best way to dela with this is to encapsulate these managed resources in a .Net class and provide a Public Dispose method in it. Users of this class can call Dispose() method to explicitly release the resources.

Is it possible control the Garbage Collection in C#.Net?

C#.Net garbage collection can be controlled using the GC framework class. It provides the method Collect() that can be used to trigger garbage collection in general or for a specific generation of objects. But this is not suggestable.

What are the Types in .Net Framework CTS (Common Type system)?

These are two types.

Value Types

  1. Built in Value Types (integer,bool..etc)
  2. User-Defined Value Types (Structures)
  3. Enumerations

Reference Types

  1. User Defined Classes
  2. Interfaces
  3. Arrays
  4. Delegates

What is Side-By-Side execution?

Side-By-Side execution is the ability to store and execute multiple versions of an application or component on the same computer. This means that you can have multiple versions of applications and components on the same computer at the same time. Side-By-Side execution gives more control over what versions of a component an application uses, and what versions of the runtime an application uses. Different versions of the .Net Framework runtime can also execute Side-By-side.

How does an AppDomain get created?

AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications.

What is difference between constants, readonly and, static ?

Constants: The value can’t be changed
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

What is namespace used for loading assemblies at run time and name the methods?

System.Reflection

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • PDF
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz

Tags: , ,

Leave your comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes