Set - 2

Question 1 :

Can you have two files with the same file name in GAC?

Answer :

Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it's possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version and the second one is

Question 2 :

So let's say I have an application that uses MyApp.dll assembly, version There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll How do I tell the client applications that are already installed to start using this new MyApp.dll?

Answer :

Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC.

Question 3 :

What is delay signing?

Answer :

Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.

Question 4 :

Is there an equivalent of exit() for quitting a C# .NET application?

Answer :

Yes, you can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it's a Windows Forms app.

Question 5 :

Can you prevent your class from being inherited and becoming a base class for some other classes?

Answer :

Yes, that is what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It is the same concept as final class in Java.