81⟩ What is a delegate in C#?
C# delegate is a:
1. A strongly typed function pointer.
2. A light weight thread or process that can call a single method.
3. A reference to an object in a different process.
4. An inter-process message channel.
“Learn C# (Sharp) Programming Language by Interview Questions and Answers”
C# delegate is a:
1. A strongly typed function pointer.
2. A light weight thread or process that can call a single method.
3. A reference to an object in a different process.
4. An inter-process message channel.
1. The runtime checks to see that only one version of an assembly is on the machine at any one time.
2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.
3. The compiler offers compile time checking for backward compatibility.
4. It doesn't.
public class A { private A instance; private A() { } public static A Instance { get { if ( A == null ) A = new A(); return instance; } } }1. Factory
2. Abstract Factory
3. Singleton
4. Builder
1. TestAttribute
2. TestClassAttribute
3. TestFixtureAttribute
4. NUnitTestClassAttribute
1. A DataSet can be synchronised with the database.
2. A DataSet can be synchronised with a RecordSet.
3. A DataSet can be converted to XML.
4. You can infer the schema from a DataSet.
1. The conversion of one type of object to another in C#.
2. The runtime resolution of method calls in C#.
3. The exposition of data in C#.
4. The separation of interface and implementation in C#.
Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications.
Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.
No there is not possible to inline assembly or IL in C# code.
A strong name includes the name of the assembly, version number, culture identity, and a public key token.
Use the directive in the XML .config file for a given application.
< probing privatePath=c:mylibs; bindebug />
should do the trick. Or you can add additional search paths in the Properties box of the deployed application.
Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.
Global assembly cache.
With the help of Strong Name tool (sn.exe).
Usually C:winntassembly or C:windowsassembly.
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 1.0.0.0 and the second one is 1.1.0.0.
So let’s say I have an application that uses MyApp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new MyApp.dll?
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.
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.
Yes, you can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it's a Windows Forms app.
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.