Framework Faq s

30
1. What is .NET Framework? .NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications: Console applications Windows Forms applications Windows Presentation Foundation (WPF) applications Web applications (ASP.NET applications) Web services Windows services Service-oriented applications using Windows Communication Foundation (WCF) Workflow-enabled applications using Windows Workflow Foundation (WF) .NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language. 2. What are the main components of .NET Framework? .NET Framework provides enormous advantages to software developers in comparison to the advantages provided by other platforms. Microsoft has united various modern as well as existing technologies of software development in .NET Framework. These technologies are used by developers to develop highly efficient applications for modern as well as future business needs. The following are the key components of .NET Framework: .NET Framework Class Library Common Language Runtime Dynamic Language Runtimes (DLR) Application Domains Runtime Host Common Type System Metadata and Self-Describing Components Cross-Language Interoperability .NET Framework Security

description

Framework FAQS

Transcript of Framework Faq s

1. What is .NET Framework?

.NET Framework is a complete environment that allows developers to develop, run, and deploy the following applications:

Console applications

Windows Forms applications

Windows Presentation Foundation (WPF) applications

Web applications (ASP.NET applications)

Web services

Windows services

Service-oriented applications using Windows Communication Foundation (WCF)

Workflow-enabled applications using Windows Workflow Foundation (WF)

.NET Framework also enables a developer to create sharable components to be used in distributed computing architecture. NET Framework supports the object-oriented programming model for multiple languages, such as Visual Basic, Visual C#, and Visual C++. .NET Framework supports multiple programming languages in a manner that allows language interoperability. This implies that each language can use the code written in some other language.

2. What are the main components of .NET Framework?

.NET Framework provides enormous advantages to software developers in comparison to the advantages provided by other platforms. Microsoft has united various modern as well as existing technologies of software development in .NET Framework. These technologies are used by developers to develop highly efficient applications for modern as well as future business needs. The following are the key components of .NET Framework:

.NET Framework Class Library

Common Language Runtime

Dynamic Language Runtimes (DLR)

Application Domains

Runtime Host

Common Type System

Metadata and Self-Describing Components

Cross-Language Interoperability

.NET Framework Security

Profiling

Side-by-Side Execution

3. List the new features added in .NET Framework 4.0.

The following are the new features of .NET Framework 4.0:

Improved Application Compatibility and Deployment Support

Dynamic Language Runtime

Managed Extensibility Framework

Parallel Programming framework

Improved Security Model

Networking Improvements

Improved Core ASP.NET Services

Improvements in WPF 4

Improved Entity Framework (EF)

Integration between WCF and WF

4. What is an IL?

Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

5. What is Manifest?

Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things

Version of assembly.

Security identity.

Scope of the assembly.

Resolve references to resources and classes.

The assembly manifest can be stored in a PE file either (an .exe or) .dll with Microsoftintermediate language (MSIL code with Microsoft intermediate language (MSIL) code or in astand-alone PE file, that contains only assembly manifest information.

6. What are code contracts?

Code contracts help you to express the code assumptions and statements stating the behavior of your code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions and object-invariants. The contracts help you to improve-testing by enabling run-time checking, static contract verification, and documentation generation.

TheSystem.Diagnostics.Contractsnamespace contains static classes that are used to express contracts in your code.

7. Name the classes that are introduced in theSystem.Numericsnamespace.

The following two new classes are introduced in theSystem.Numericsnamespace:

BigInteger- Refers to a non-primitive integral type, which is used to hold a value of any size. It has no lower and upper limit, making it possible for you to perform arithmetic calculations with very large numbers, even with the numbers which cannot hold by double or long.

Complex- Represents complex numbers and enables different arithmetic operations with complex numbers. A number represented in the forma + bi, whereais the real part, andbis the imaginary part, is a complex number.

8. What is managed extensibility framework?

Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.

9. Explain memory-mapped files.

Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files enable the multiple processes running on the same machine to share data with each Other. TheMemoryMappedFile.CreateFromFile()method is used to obtain aMemoryMappedFileobject that represents a persisted memory-mapped file from a file on disk.

These files are included in theSystem.IO.MemoryMappedFilesnamespace. This namespace contains four classes and three enumerations to help you access and secure your file mappings.

10. What is Common Type System (CTS)?

CTS is the component of CLR through which .NET Framework provides support for multiple languages because it contains a type system that is common across all the languages. Two CTS-compliant languages do not require type conversion when calling the code written in one language from within the code written in another language. CTS provide a base set of data types for all the languages supported by.NET Framework. This means that the size of integer and long variables is same across all .NET-compliant programming languages. However, each language uses aliases for the base data types provided by CTS. For example, CTS uses the data type system. int32 to represent a 4 byte integer value; however, Visual Basic uses the alias integer for the same; whereas, C# uses the alias int. This is done for the sake of clarity and simplicity.

11. Give a brief introduction on side-by-side execution. Can two applications, one using private assembly and the other using the shared assembly be stated as side-by-side executables?

Side-by-side execution enables you to run multiple versions of an application or component and CLR on the same computer at the same time. As versioning is applicable only to shared assemblies and not to private assemblies, two applications, one using a private assembly and other using a shared assembly, cannot be stated as side-by-side executables.

12. Which method do you use to enforce garbage collection in .NET?

TheSystem.GC.Collect()method.

13. State the differences between theDispose()andFinalize().

CLR uses the Dispose and Finalize methods to perform garbage collection of run-time objects of .NET applications.

TheFinalizemethod is called automatically by the runtime. CLR has a garbage collector (GC), which periodically checks for objects in heap that are no longer referenced by any object or program. It calls the Finalize method to free the memory used by such objects. TheDisposemethod is called by the programmer.Disposeis another method to release the memory used by an object. The Dispose method needs to be explicitly called in code to dereference an object from the heap. TheDisposemethod can be invoked only by the classes that implement theIDisposableinterface.

14. What is code access security (CAS)?

Code access security (CAS) is part of the .NET security model that prevents unauthorized access of resources and operations, and restricts the code to perform particular tasks.

15. Differentiate between managed and unmanaged code?

Managed code is the code that is executed directly by the CLR instead of the operating system. The code compiler first compiles the managed code to intermediate language (IL) code, also called as MSIL code. This code doesn't depend on machine configurations and can be executed on different machines.

Unmanaged code is the code that is executed directly by the operating system outside the CLR environment. It is directly compiled to native machine code which depends on the machine configuration.In the managed code, since the execution of the code is governed by CLR, the runtime provides different services, such as garbage collection, type checking, exception handling, and security support. These services help provide uniformity in platform and language-independent behavior of managed code applications. In the unmanaged code, the allocation of memory, type safety, and security is required to be taken care of by the developer. If the unmanaged code is not properly handled, it may result in memory leak. Examples of unmanaged code are ActiveX components and Win32 APIs that execute beyond the scope of native CLR.

16. What are tuples?

Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.

17. How can you turn-on and turn-off CAS?

YOU can use the Code Access Security Tool (Caspol.exe) to turn security on and off.

To turn off security, type the following command at the command prompt:caspol -security off

To turn on security, type the following command at the command prompt:caspol -security on

In the .NET Framework 4.0, for using Caspol.exe, you first need to set theelement totrue.

18. What is garbage collection? Explain the difference between garbage collections in .NET 4.0 and earlier versions.

Garbage collection prevents memory leaks during execution of programs. Garbage collector is a low-priority process that manages the allocation and deallocation of memory for your application. It checks for the unreferenced variables and objects. If GC finds any object that is no longer used by the application, it frees up the memory from that object.

GC has changed a bit with the introduction of .NET 4.0. In .NET 4.0, theGC.Collect()method contains the following overloaded methods:

GC.Collect(int)

GC.Collect(int, GCCollectionMode)

Another new feature introduced in .NET is to notify you when theGC.Collect()method is invoked and completed successfully by using different methods. The .NET 4.0 supports a new background garbage collection that replaces the concurrent garbage collection used in earlier versions. This concurrent GC allocates memory while running and uses current segment (which is 16 MB on a workstation) for that. After that, all threads are suspended. In case of background GC, a separate ephemeral GC - gen0 and gen1 can be started, while the full GC - gen0, 1, and 2 - is already running.

19. How does CAS works?

There are two key concepts of CAS security policy- code groups and permissions. A code group contains assemblies in it in a manner that each .NET assembly is related to a particular code group and some permissions are granted to each code group. For example, using the default security policy, a control downloaded from a Web site belongs to the Zone, Internet code group, which adheres to the permissions defined by the named permission set. (Normally, the named permission set represents a very restrictive range of permissions.)

Assembly execution involves the following steps:

1. Evidences are gathered about assembly.

2. Depending on the gathered evidences, the assembly is assigned to a code group.

3. Security rights are allocated to the assembly, depending on the code group.

4. Assembly runs as per the rights assigned to it.

20. What is Difference between NameSpace and Assembly?

Following are the differences between namespace and assembly: Assembly is physical grouping of logical units, Namespace, logically groups classes.

Namespace can span multiple assembly.

21. Mention the execution process for managed code.

A piece of managed code is executed as follows:

Choosing a language compiler

Compiling the code to MSIL

Compiling MSIL to native code

Executing the code.

22. Is there a way to suppress the finalize process inside the garbage collector forcibly in .NET?

Use theGC.SuppressFinalize()method to suppress the finalize process inside the garbage collector forcibly in .NET.

23. How can you instantiate a tuple?

The following are two ways to instantiate a tuple:

Using thenewoperator. For example,

Tuple t = new Tuple ("Hellow", 2); Using theCreatefactory method available in the Tuple class. For example,

Tuple t = Tuple.Create (2, 4, 5);24. Which is the root namespace for fundamental types in .NET Framework?

System.Objectis the root namespace for fundamental types in .NET Framework.

25. What are the improvements made in CAS in .NET 4.0?

The CAS mechanism in .NET is used to control and configure the ability of managed code. Earlier, as this policy was applicable for only native applications, the security guarantee was limited. Therefore, developers used to look for alternating solutions, such as operating system-level solutions. This problem was solved in .NET Framework 4 by turning off the machine-wide security. The shared and hosted Web applications can now run more securely. The security policy in .NET Framework 4 has been simplified using the transparency model. This model allows you to run the Web applications without concerning about the CAS policies.

As a result of security policy changes in .NET Framework 4.0, you may encounter compilation warnings and runtime exceptions, if your try to use the obsolete CAS policy types and members either implicitly or explicitly. However, you can avoid the warnings and errors by using theconfiguration element in the runtime settings schema to opt into the obsolete CAS policy behavior.

26. What is Microsoft Intermediate Language (MSIL)?

The .NET Framework is shipped with compilers of all .NET programming languages to develop programs. There are separate compilers for the Visual Basic, C#, and Visual C++ programming languages in .NET Framework. Each .NET compiler produces an intermediate code after compiling the source code. The intermediate code is common for all languages and is understandable only to .NET environment. This intermediate code is known as MSIL.

27. What is lazy initialization?

Lazy initialization is a process by which an object is not initialized until it is first called in your code. The .NET 4.0 introduces a new wrapper class,System.Lazy, for executing the lazy initialization in your application. Lazy initialization helps you to reduce the wastage of resources and memory requirements to improve performance. It also supports thread-safety.

28. How many types of generations are there in a garbage collector?

Memory management in the CLR is divided into three generations that are build up by grouping memory segments. Generations enhance the garbage collection performance. The following are the three types of generations found in a garbage collector:

Generation 0 - When an object is initialized, it is said to be in generation 0.

Generation 1 - The objects that are under garbage collection process are considered to be in generation 1.

Generation 2 - Whenever new objects are created and added to the memory, they are added to generation 0 and the old objects in generation 1 are considered to be in generation 2.

29. Explain covariance and contra-variance in .NET Framework 4.0. Give an example for each.

In .NET 4.0, the CLR supports covariance and contravariance of types in generic interfaces and delegates. Covariance enables you to cast a generic type to its base types, that is, you can assign a instance of typeIEnumerableto a variable of typeIEnumerablewhere,T1derives fromT2. For example,

IEnumerable str1= new List ();

IEnumerable str2= str1;

Contravariance allows you to assign a variable ofActionto a variable of typeAction. For example,

IComparer obj1 = GetComparer()

IComparer obj2 = obj1;

.NET framework 4.0 uses some language keywords (out and in) to annotate covariance and contra-variance. Out is used for covariance, while in is used for contra-variance.

Variance can be applied only to reference types, generic interfaces, and generic delegates. These cannot be applied to value types and generic types.

30. How do you instantiate a complex number?

The following are the different ways to assign a value to a complex number:

By passing twoDoublevalues to its constructor. The first value represents the real, and the second value represents imaginary part of a complex number.For example,

Complex c1 = new Complex(5, 8); /* It represents (5, 8) */

By assigning aByte,SByte,Intl6,UIntl6,Int32,UInt32,Int64,UInt64,Single, orDoublevalue to aComplexobject. The assigned value represents the real part of the complex number, and its imaginary part becomes0. For example,Complex c2 = 15.3; /* It represents (15.3, 0) */

By casting aDecimalorBigIntegervalue to aComplexobject.For example,

Complex c3 = (Complex) 14.7; /* It represents (14.7, 0) */

Assigning the value returned by an operator to aComplexvariable.For example,

Complex c4 = c1 + c2; /* It represents (20.3, 8) */31. What is Common Language Specification (CLS)?

CLS is a set of basic rules, which must be followed by each .NET language to be a .NET- compliant language. It enables interoperability between two .NET-compliant languages. CLS is a subset of CTS; therefore, the languages supported by CLS can use each other's class libraries similar to their own. Application programming interfaces (APIs), which are designed by following the rules defined in CLS can be used by all .NET-compliant languages.

32. What is the role of the JIT compiler in .NET Framework?

The JIT compiler is an important element of CLR, which loads MSIL on target machines for execution. The MSIL is stored in .NET assemblies after the developer has compiled the code written in any .NET-compliant programming language, such as Visual Basic and C#.

JIT compiler translates the MSIL code of an assembly and uses the CPU architecture of the target machine to execute a .NET application. It also stores the resulting native code so that it is accessible for subsequent calls. If a code executing on a target machine calls a non-native method, the JIT compiler converts the MSIL of that method into native code. JIT compiler also enforces type-safety in runtime environment of .NET Framework. It checks for the values that are passed to parameters of any method.

For example, the JIT compiler detects any event, if a user tries to assign a 32-bit value to a parameter that can only accept 8-bit value.

33. What is difference betweenSystem.StringandSystem.StringBuilderclasses?

StringandStringBuilderclasses are used to store string values but the difference in them is that String is immutable (read only) by nature, because a value once assigned to a String object cannot be changed after its creation. When the value in the String object is modified, a new object is created, in memory, with a new value assigned to theStringobject. On the other hand, theStringBuilderclass is mutable, as it occupies the same space even if you change the value. TheStringBuilderclass is more efficient where you have to perform a large amount of string manipulation.

34. Describe the roles of CLR in .NET Framework.

CLR provides an environment to execute .NET applications on target machines. CLR is also a common runtime environment for all .NET code irrespective of their programming language, as the compilers of respective language in .NET Framework convert every source code into a common language known as MSIL or IL (Intermediate Language).

CLR also provides various services to execute processes, such as memory management service and security services. CLR performs various tasks to manage the execution process of .NET applications.

The responsibilities of CLR are listed as follows:

Automatic memory management

Garbage Collection

Code Access Security

Code verification

JIT compilation of .NET code

35. What is the difference between int and int32.

There is no difference betweenintandint32.System.Int32is a .NET Class andintis an alias name forSystem.Int32.

What is a IL or What is MSIL or CIL , What is JIT?(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In- Time (JIT) compiler.

What is a CLR?Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example VC++ has MSCRT40.DLL,VB6 has MSVBVM60.DLL, Java has Java Virtual Machine etc. Similarly .NET has CLR. Following are the responsibilities of CLR:-1. Garbage Collection - CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.2. Code Access Security - CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.3. Code Verification - This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.IL( Intermediate language )-to-native translators and optimizers - CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.

What is a CTS?In order that two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these datatypes are not compatible so the interfacing between them is very complicated. In order to able that two different languages can communicate Microsoft introduced Common Type System. So "Integer" datatype in VB6 and "int" datatype in C++ will convert it to System.int32 which is datatype of CTS. CLS which is covered in the coming question is subset of CTS. Note: If you have undergone COM programming period interfacing VB6 application with VC++ application was a real pain as the datatype of both languages did not have a common ground where they can come and interface, by having CTS interfacing is smooth.

What is a CLS(Common Language Specification)?This is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.

What is a Managed Code?Managed code runs inside the environment of CLR i.e. .NET runtime. In short all IL are managed code. But if you are using some third party software example VB6 or VC++ component they are unmanaged code as .NET runtime (CLR) does not have control over the source code execution of the language.

What is a Assembly?1. Assembly is unit of deployment like EXE or a DLL.2. An assembly consists of one or more files (dlls, exes, html files etc.), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing.3. An assembly is completely self-describing.An assembly contains metadata information, which is used by the CLR for everything from type checking and security to actually invoking the components methods. As all information is in the assembly itself, it is independent of registry. This is the basic advantage as compared to COM where the version was stored in registry.4. Multiple versions can be deployed side by side in different folders. These different versions can execute at the same time without interfering with each other. Assemblies can be private or shared. For private assembly deployment, the assembly is copied to the same directory as the client program that references it. No registration is needed, and no fancy installation program is required. When the component is removed, no registry cleanup is needed, and no uninstall program is required. Just delete it from the hard drive.5. In shared assembly deployment, an assembly is installed in the Global Assembly Cache (or GAC). The GAC contains shared assemblies that are globally accessible to all .NET applications on the machine.

What are the different types of Assembly?There are two types of assembly Private and Public assembly. A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. Crystal report classes which will be used by all application for Reports.

What is NameSpace?Namespace has two basic functionality :-1. NameSpace Logically group types, example System.Web.UI logically groups our UI related features.2. In Object Oriented world many times its possible that programmers will use the same class name.By qualifying NameSpace with classname this collision is able to be removed.

What is Difference between NameSpace and Assembly?Following are the differences between namespace and assembly :-1. Assembly is physical grouping of logical units. Namespace logically groups classes.2. Namespace can span multiple assembly.

What is Manifest?Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things:-1. Version of assembly.2. Security identity.3. Scope of the assembly.4. Resolve references to resources and classes.5. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a stand-alone PE file that contains only assembly manifest information.

Where is version information stored of an assembly?Version information is stored in assembly in manifest.

Is versioning applicable to private assemblies?Versioning concept is only applicable to global assembly cache (GAC) as private assembly lie in their individual folders.

What is GAC?GAC (Global Assembly Cache) is used where shared .NET assembly reside. GAC is used in the following situations :-1. If the application has to be shared among several application.2. If the assembly has some special security requirements like only administrators can remove the assembly. If the assembly is private then a simple delete of assembly the assembly file will remove the assembly.

What is the concept of strong names?Strong name is similar to GUID(It is supposed to be unique in space and time) in COM components.Strong Name is only needed when we need to deploy assembly in GAC. Strong Names helps GAC to differentiate between two versions. Strong names use public key cryptography (PKC) to ensure that no one can spoof it.PKC use public key and private key concept.

How to add and remove an assembly from GAC?There are two ways to install .NET assembly in GAC:-1. Using Microsoft Installer Package. You can get download of installer fromhttp://www.microsoft.com.2. Using Gacutil. Goto "Visual Studio Command Prompt" and type "gacutil i (assembly_name)", where (assembly_name) is the DLL name of the project.

What is garbage collection?Garbage collection is a CLR feature which automatically manages memory. Programmers forget to release the objects while coding.(Remember in VB6 where one of the good practices is to set object to nothing). CLR automatically releases objects when they are no longer in use and refernced. CLR runs on non-deterministic to see the unused objects and cleans them. One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. Therefore, we should not put code into a class destructor to release resources.

Can we force garbage collector to run?System.GC.Collect() forces garbage collector to run. This is not recommended but can be used if situations arises.

What is reflection?All .NET assemblies have metadata information stored about the types defined in modules. This metadata information can be accessed by mechanism called as "Reflection".System. Reflection can be used to browse through the metadata information.

What are Value types and Reference types?Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure. Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable. All types derive from the System.Object base type.

What is concept of Boxing and Unboxing?Boxing permits any value type to be implicitly converted to type object or to any interface type implemented by value type. Boxing is a process in which object instances are created and copy values in to that instance. Unboxing is vice versa of boxing operation where the value is copied from the instance in to appropriate storage location. Below is sample code of boxing and unboxing where integer data type is converted in to object and then vice versa.Dim x As IntegerDim y As Objectx =10y = x boxing processx = y unboxing process

What is the difference between VB.NET and C#?Well this is the most debatable issue in .NET community and people treat there languages like religion. Its a subjective matter which language is best. Some like VB.NETs natural style and some like professional and terse C# syntaxes. Both use the same framework and speed is also very much equivalents. But still lets list down some major differences between them :- Advantages VB.NET :-1. Has support for optional parameters which makes COM interoperability much easy.2. With Option Strict off late binding is supported.Legacy VB functionalities can be used by using Microsoft.VisualBasic namespace.3. Has the WITH construct which is not in C#.4. The VB.NET part of Visual Studio .NET compiles your code in the background. While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.Advantages of C#1. XML documentation is generated from source code but this is now been incorporated in Whidbey.2. Operator overloading which is not in current VB.NET.3. Use of this statement makes unmanaged resource disposal simple.4. Access to Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies).This is the major difference that you can access unmanaged code in C# and not in VB.NET.

What is CODE Access security?CAS is part of .NET security model that determines whether or not a piece of code is allowed to run and what resources it can use while running. Example CAS will allow an application to read but not to write and delete a file or a resource from a folder..

How to prevent my .NET DLL to be decompiled?By design .NET embeds rich Meta data inside the executable code using MSIL. Any one can easily decompile your DLL back using tools like ILDASM (owned by Microsoft) or Reflector for .NET which is a third party. Secondly there are many third party tools which make this decompiling process a click away. So any one can easily look in to your assemblies and reverse engineer them back in to actual source code and understand some real good logic which can make it easy to crack your application. The process by which you can stop this reverse engineering is using "obfuscation". Its a technique which will foil the decompilers. There are many third parties (XenoCode, Demeanor for .NET) which provide .NET obfuscation solution. Microsoft includes one that is Dotfuscator Community Edition with Visual Studio.NET.

What is the difference between Convert.toString and .toString() method?Just to give an understanding of what the above question means seethe below code.int i =0;MessageBox.Show(i.ToString());MessageBox.Show(Convert.ToString(i));We can convert the integer "i" using "i.ToString()" or "Convert.ToString" so whats the difference. The basic difference between them is "Convert" function handles NULLS while "i.ToString()" does not it will throw a NULL reference exception error. So as good coding practice using "convert" is always safe.

What is Native Image Generator (Ngen.exe)?The Native Image Generator utility (Ngen.exe) allows you to run the JIT compiler on your assembly's MSIL and generate native machine code which is cached to disk. After the image is created .NET runtime will use the image to run the code rather than from the hard disk. Running Ngen.exe on an assembly potentially allows the assembly to load and execute faster, because it restores code and data structures from the native image cache rather than generating them dynamically. Below are some points to be remembered for Native Image Generator:-1. Native images load faster than MSIL because JIT compilation and type-safety verification is eliminated.2. If you are sharing code between process Ngen.exe improves the performance significantly. As Native image generated Windows PE file so a single DLL file can be shared across applications. By contrast JIT produced code are private to an assembly and can not be shared.3. Native images enable code sharing between processes.4. Native images require more storage space and more time to generate.5. Startup time performance improves lot. We can get considerable gains when applications share component assemblies because after the first application has been started the shared components are already loaded for subsequent applications. If assemblies in an application must be loaded from the hard disk, does not benefit as much from native images because the hard disk access time shadows everything.1. Assemblies in GAC do not benefit from Native image generator as the loader performs extra validation on the strong named assemblies thus shadowing the benefits of Native Image Generator.2. If any of the assemblies change then Native image should also be updated.3. You should have administrative privilege for running Ngen.exe.4. While this can fasten your application startup times as the code is statically compiled but it can be somewhat slower than the code generated dynamically by the JIT compiler. So you need to compare how the whole application performance with Ngen.exe and with out it. To run Ngen.exe, use the following command line.ngen.exe install

This will synchronously precompile the specified assembly and all of its dependencies. The generated native images are stored in the native image cache. In .NET Framework 2.0 there is a service (.NET Runtime Optimization Service) which can precompile managed assemblies in the background. You can schedule your assemblies to be precompiled asynchronously by queueing them up with the NGEN Service. Use the following command line.ngen.exe install /queue:

Assemblies which are critical to your application's start up time should either be precompiled synchronously or asynchronously with priority 1. Priority 1 and 2 assemblies are precompiled aggressively while Priority 3 assemblies are only precompiled during machine idle-time. Synchronously precompiling your critical assemblies guarantees that the native images will be available prior to the first time your end user launches the application but increases the time taken to run your application's set up program. You can uninstall an assembly and its dependencies (if no other assemblies are dependent on them) from the native image cache by running the following command.ngen.exe uninstall . Native images created using Ngen.exe cannot be deployed; instead they need to be created on the end user's machine. These commands therefore need to be issued as part of the application's setup program. Visual Studio .NET can be used to implement this behavior by defining custom actions in a Microsoft Installer (MSI) package.

What is .NET Framework?The .NET Framework is such a comprehensive platform that it can be used to develop websites, webapplications, web services and much more.

What is portable executable (PE)?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 Common 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.

Which is the base class for .net Class library?System.object.

What is Application Domain?Application domains provide a unit of isolation for the common language runtime. They are created and run inside a process. Application domains are usually created by a runtime host, which is an application responsible for loading the runtime into a process and executing user code within an application domain. The runtime host creates a process and a default application domain, and runs managed code inside it. Runtime hosts include ASP.NET, Microsoft Internet Explorer, and the Windows shell.

What is serialization in .NET?Serialization can be defined as the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.1. Binary serialization preserves type fidelity, which is useful for preserving the state of an object between different invocations of an application. For example, you can share an object between different applications by serializing it to the clipboard. You can serialize an object to a stream, disk, memory, over the network, and so forth. Remoting uses serialization to pass objects "by value" from one computer or application domain to another.2. XML serialization serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data. Because XML is an open standard, it is an attractive choice for sharing data across the Web. SOAP is an open standard, which makes it an attractive choice.

What is an Assembly?Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime withthe information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly. Assemblies are a fundamental part of programming withthe .NET Framework. An assembly performs the following functions:-1. It contains code that the common language runtime executes. Microsoft intermediate language (MSIL) code in a portable executable (PE) file will not be executed if it does not have an associated assembly manifest. Note that each assembly can have only one entry point (that is,DllMain,WinMain, orMain).2. It forms a security boundary. An assembly is the unit at which permissions are requested and granted.3. It forms a type boundary. Every types identity includes the name of the assembly in which it resides. A type called MyType loaded in the scope of one assembly is not the same as a type called MyType loaded in the scope of another assembly.4. It forms areference scope boundary. The assemblys manifest contains assembly metadata that is used for resolving types and satisfying resource requests. It specifies the types and resources that are exposed outside the assembly. The manifest also enumerates other assemblies on which it depends.5. It forms aversion boundary. The assembly is the smallest versionable unit in the common language runtime; all types and resources in the same assembly are versioned as a unit. The assemblys manifest describes the version dependencies you specify for any dependent assemblies.6. It forms a deployment unit. When an application starts, only the assemblies that the application initially calls must be present. Other assemblies, such as localization resources or assemblies containing utility classes, can be retrieved on demand. This allows applications to be kept simple and thin when first downloaded.7. It is the unit at which side-by-side execution is supported. Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in PE files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed. There are several ways to create assemblies. You can use development tools, such as Visual Studio .NET, that you have used in the past to create .dll or .exe files. You can use tools provided in the .NET Framework SDK to create assemblies withmodules created in other development environments. You can also use common language runtime APIs, such as Reflection.Emit, to create dynamic assemblies.

What are Satellite Assemblies?Satellite assemblies are often used to deploy language-specific resources for an application. These language-specific assemblies work in side-by-side execution because the application has a separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language. When uninstalling, the application removes only the satellite assemblies associated witha given language and .NET Framework version. No core .NET Framework files are removed unless the last language for that .NET Framework version is being removed.

What is Assembly manifest?Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assemblys version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) withMicrosoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information. It contains Assembly name, Version number, Culture, Strong name information, List of all files in the assembly, Type reference information, Information on referenced assemblies.

What are the contents of assembly?In general, a static assembly can consist of four elements:-1. The assembly manifest, which contains assembly metadata.2. Type metadata.3. Microsoft intermediate language (MSIL) code that implements the types.4. A set of resources.

Difference between assembly manifest & metadata assembly manifest?An integral part of every assembly that renders the assembly self-describing. The assembly manifest contains the assemblys metadata. The manifest establishes the assembly identity, specifies the files that make up the assembly implementation, specifies the types and resources that make up the assembly, itemizes the compile-time dependencies on other assemblies, and specifies the set of permissions required for the assembly to run properly. This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible. metadata -Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on. This can include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime.

What is Global Assembly Cache (GAC) and what is the significance of it?Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache 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.

What is the difference between Readonly and Constant?Aconstfield can only be initialized at the declaration of the field. Areadonlyfield can be initialized either at the declaration or in a constructor. Therefore,readonlyfields can have different values depending on the constructor used. Also, while aconstfield is a compile-time constant, thereadonlyfield can be used for runtime constants, as in the following example: public static readonly uint l1 = (uint) DateTime.Now.Ticks;

What is the managed and unmanaged code in .net?The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtimes functionality and enable you to write code that benefits from this managed execution environment. Code that you develop witha language compiler that targets the runtime is calledmanaged code; itbenefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.

PAGE NO.12

How to implement cloning in .NET ? What is shallow copy and deep copy ?Cloning is achieved by using ICloneable of the System namespace. It has a "Clone" method which actually returns the reference of the same copy. Clone method allows a Shallow copy and not a deep copy. In Shallow copy if you make changes to the cloned object it actually changes on the main object itself. So how is deep copy achieved, by using "ISerializable" interface? So what you do is first serialize the object then deserialize back to a complete new copy. Now any changes to this new copy do not reflect on the original copy of the object, this is called as Deep copy.

How can I write IL programs directly?Assembly MyAssembly {}.class MyApp {.method static void Main() {.entrypointldstr "Hello, IL!"call void System.Console::WriteLine(class System.Object)ret}}.

Which name space is the base class for .net Class library?language should comply with the Common Language Runtime standard to become a.NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.

What is the Microsoft.NET?.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services. It also provides a language independent, consistent programming model across all tiers of an application.

The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications.

What is the .NET Framework?The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft's managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.

The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.

What is CLR?The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications.

What is CTS?Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.

What is CLS?Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages.

What is managed code?The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution 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?JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.

Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls.

What is portable executable (PE)?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 Common 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 an application domain?Application domain is the boundary within which an application runs. A process can contain multiple application domains. Application 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 a proxy.

How does an AppDomain get created?AppDomains are usually created byhosts. 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 an assembly?An assembly is a collection of one or more .exe or dlls. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations.

What are the contents of assembly?A static assembly can consist of four elements:

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.

Type metadata - Binary information that describes a program.

Microsoft intermediate language (MSIL) code.

A set of resources.

What are the different types of assembly?Assemblies can also be private or shared. A private assembly is installed in the installation directory of an application and is accessible to that application only. On the other hand, a shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.

We also have satellite assemblies that are 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 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

- Create a strong name using sn.exe tool eg: sn -k mykey.snk

- in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]

- recompile project, and then install it to GAC in two ways :

drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)

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 a garbage collector?A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.

What are generations and how are they used by the garbage collector?Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations.

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.exeused 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.Dotnet Assemblyinterviewquestionsandanswers

Define .Net Assembly.What does an assembly contain?Define aprivate assembly and a shared assembly.What are Satellite Assemblies?What do you understand by side-by-site execution of assembly?How do you create a resource-only assembly?Explain how to retrieve resources using ResourceManager class.Define Strong Name. How do you apply a strong name to assembly?How do you install assembly to the Global Assembly Cache?What is AL.EXE and RESGEN.EXE?Explain the concepts and capabilities of Assembly in .NETWhat is Manifest in .NET?What is GAC in .NET?.Net Framework

This includes introduction of .Net framework, .Net framework architecture, role of assembly and GAC.

1) What are the advantages of .Net?

1) Good Design

2) Object-Oriented Programming Using C# and .NET which are based on object-oriented Concepts.

3) Language Independence All the languages which are supported by .Net ( VB.NET, C#, J#, and managed C++ ) are compiled in to common Intermediate Language (IL) . So IL make sure that languages are interoperable.

4) Efficient Data Access ADO.NET provide fast and efficient way to access RDBMS, file system etc

5) Code Sharing .To share code between applications, a new concept called assembly is introduced. Assemblies supports versioning.

6) Improved Security

7) Support Dynamic Web Pages Using ASP.NET.

8) Support for Web Services

2) What is .Net Framework ?The .NET framework is a programming framework from Microsoft. Developers can use .Net Framework to develop applications,install and run the application on Windows operating systems.

3) What is MS-IL (Microsoft Intermediate Language) ?When a program is complied in .Net , the source code will be converted into an intermediate language called Microsoft Intermediate Language (MS-IL) . This is done by Just-In time Compiler (JIT). .Net framework is built in such a way that , Code is Just-In time complied, that is it get complied when it is called rather compiling entire code at the start up. A portion of the code will get complied only once and it will exists till the application exit. This will have a significant improvement in performance since entire section of the code wont get executed in most cases.

4) What is Common Language Runtime (CLR) ?Common Language Runtime or CLR is the run-time execution environment of .Net Framework. Converting MS-IL into platform or OS specific code is done by CLR. Currently .Net programs will run only in windows.

5) What is Common Type System (CTS) ?.Net uses Common Type System (CTS) for Language Interoperability. CTS defines the predefined data types that are available in IL, so that all languages that target the .NET framework will produce compiled code that is ultimately based on these types. So that a data type defined in a VB.net will be understood by C#. For example, VB.Net uses Integer to define data type Integer. C# uses int to define data type Integer. When VB.Net code is complied , it will convert Integer to Int32 and since C# refers Int to Int32 VB.Net code will be understood by C#.

6) What is Common Language Specification (CLS) ?Common Language Specification (CLS) is also used for Language Interoperability in tandem with CTS to ensure Language Interoperability. CLS defines a set of minimum standards that all compilers targeting .NET must support. For example VB.Net is not case sensitive. So attribute EmployeeName and employeename is considered same. But C# is case sensitive. So for language interoperability , C# doesn't allow two variable which differs only in Case.

7) What is Garbage Collector ?Garbage Collector is used in .Net Framework for memory management. While running an application, application request for memory for its internal use. Framework allocates memory from the heap. Once the process is completed , allocated need to be reclaimed for future use. The process of reclaiming unused memory is taken care by Garbage Collector.

8) How to invoke garbage collector programmatically ?To call garbage collector programmatically, use code GC.Collect();

9) What is a Managed Code ?Managed code is code that cane be executed and managed by .NET Framework Common Language Runtime. All code based on Intermediate language executes as managed code.

10) What is an Assembly ?Assemblies are self-describing logical unit, consisting of one or more files targeted at .Net. An assembly can be stored across single file such as a single DLL or EXE that includes meta data, or it can be stored in multiple files, for example, resource files, meta data, DLL's, and an EXE. Assemblies support versioning.

11) What is Assembly Manifest ?Part of assembly which contains assembly meta data that describes the assembly itself is known as manifest. Assembly manifest contain Assembly Name ,Version Number,Culture, Strong name, List of files inside the assembly and Reference information

12) What are different types of Assembly ?The two types of Assemblies are Shared and Private.

13) What is Private Assembly ?Private Assemblies are intended to be used by the program for which its made for. This is because application will only load private assemblies that are located in the same folder or in a sub folder that the main executable is loaded.

14) What is Shared Assembly ?Shared Assemblies contain Common Libraries which are intended to be used by multiple applications. While making shared assemblies, Name Collisions and Overwriting existing Assemblies need to be taken care. Name Collisions can be taken care by strong name. And global assembly cache can be used to avoid assembly overwriting.

15) How to view a Assembly information ?By using Ildasm.exe which is an MSIL Disassembler one can view attributes, references to other modules and assemblies

16) Where is the assembly version information stored ?In the Manifest.

17) What is NameSpace ?Namespace is a logical grouping of related classes and types. Every class should have a NameSpace.

18) What is the Difference between NameSpace and Assembly?Namespace:1) Form the logical boundary for a Group of classes.

2) It is a Collection of names wherein each name is Unique.

3) Namespace must be specified in Project-Properties.

Assembly:1) Assemblies are Self-Describing

2) It is an Output Unit. It is a unit of Deployment & a unit of versioning. Assemblies contain MSIL code.

19) What is Global Assembly Cache (GAC) ?While using shared assemblies, to avoid Assembly being overwritten by a different version of the same assembly , shared assemblies are placed in a special directory subtree in the file system, known as the global assembly cache (GAC). Placing shared assemblies can be done by special .Net Utilities Only.

20) What is concept of strong names ?While using shared assemblies, in order to avoid name collisions strong names are used. Strong Names are based on private key cryptography , ie private assemblies are simply given the same name as their main file name.

21) How to add and remove a assembly from GAC?To install assembly in Cache use Gacutil. Goto "Visual Studio Command Prompt" and type "gacutil -i

", where (assembly_name) is the DLL name of the project. To uninstall assembly, type gacutil u in Visual Studio Command Prompt.

22) What is Reflection?Reflection is used to dynamically load a class , create object and invoke methods at runtime. It can also be used read its own meta data to find assemblies, modules and type information at runtime.

23) What is Delay signing ?To create a strong named assembly and want this assembly to be used by someone else, we partially build this assembly by provide a Public Key. We write this Public Key in the AssemblyInfo.vb OR .cs file. We also add an attribute by the named to the assembly info file. This makes it sure that when we build the assembly, It would be containing the information only about the public key before we deliver it to our client. This is a partial strong named assembly that we have created, and hence it is called Delayed Assembly.

24) What are different type of JIT ?Different Types of JIT are

1) Pre-JIT - Complies complete source code into native code at the time of deployment

2) Econo-JIT - Complies methods that are called at runtime.

3) Normal-JIT - Complies methods that are called at runtime and get stored in cache. Next time when the same method is called, it will be taken from cache.

25) What are Value types and Reference types ?There are two types of data types in .Net, Value types and Reference types.Value types are stored in stack part of the memory. Reference type are stored in managed heap. Let have a look at the example for better understanding.

Int iCount = 0; \\ Value Type

int NewiCount = iCount; \\ Reference Type

26) What is concept of Boxing and Unboxing ?Converting a value type to reference type is called Boxing. Converting a reference type to value type is called Unboxing.

27) Whats difference between System exceptions and Application exceptions?System exceptions are common exceptions thrown by the CLR of .Net Framework. Application exceptions can be user defined exceptions thrown by the application.

28) What is CODE Access security?CODE Access security is a security model that lets us grant or deny execution permissions to an assembly according to its "properties," called evidence, such as its strong name or publisher

29) What is a satellite assembly?A satellite assembly are used when multilingual (UI) application are created. Satellite assembly is a compiled library that contains localized resources which provides us with the capability of designing and deploying solutions to multiple cultures, rather than hard coding texts, bitmaps etc

30) How to prevent my .NET DLL to be decompiled ?We can prevent .NET DLL to be decompiled up to an extent by Obfuscate Source code, asymmetric encryption and encrypted w32 wrapper application.

31) What is Native Image Generator (Ngen.exe) ?Ngen.exe creates compiled processor-specific machine code called native images, which are files and installs them into the native image cache on the local computer. The runtime will use native images from the cache rather than using the JIT compiler to compile the original assembly.

32) What is Code Document Object Model (CodeDom) ?Code Document Object Model are code generators which are used to minimize repetitive coding tasks, and to minimize the number of human-generated source code lines.