event:
1) It is a data member of a type(class/structure)
2)It is declared inside a type(class/structure)
3) It is used to generate notifications which are then passed to methods though
delegates.
delegate:
1)It is a datatype(reference type) that holds references of methods with
some signatures.also called as function pointer.
2)It may or may not be declared inside a class.
3)It is used as the return type of an event and used in passing messages from event to methods.
event-->delegate-->method
example:
namespace dd
{
//delegate declaration
delegate void first();
class cc
{
//event declaration
public first myevent;
}
}
example 2:
button1.Click+=new EventHandler(this.button1_Click);
(Windows Applications)
Click is the event that returns an instance of the EventHandler delegate.
EventHandler delegate has the reference of button1_Click event and that
helps in the communication betwen the Click event and button1_Click method |
Yes, versioning is applicable to private assemblies too
There are 2 types of versions:
1)File version
2)Assembly version
File version is the default version that is assigned to any .NET assembly
example: click a .exe and view its properties: File version would always be there
Assembly version is applicable when we create a shared assembly(assembly installed
in a GAC)
Private assemblies do not have Assembly version, but they do have File Version |
It is the execution boundary within which an application runs.
Application Domain is created inside a process.
One process can have multiple Application Domains.
Example:
Consider a Remoting scenario:
2 exe's of the client and the server are communicating with each other.
2 Application Domains will be created in the process of the server.
Process: In this case, it is the executable of the Operating System that will control the interaction of the client and server exe's.
the 2 exes's run in their Application Domains that will be created in the
execution area(in the RAM) of the OS exe.
Application Domains provide the isolation of the 2 exe's(i.e. the client and the
server). |
We can chain the call of constructor from child class to base class depending on our requirement. This concept makes sure that the matching base class constructor must be called based on the parameter passed to the child class constructor.
Example:
namespace ConsoleApplication1
{
class A
{
public A(){
Console.WriteLine("Constructor A.");
}
public A(string s){
Console.WriteLine("Constructor A with parameter = {0}",s);
}
public A(string s,string t){
Console.WriteLine("Constructor A with parameter = {0} & {1}", s,t);
}
}
class B:A
{
public B():base(){
Console.WriteLine("Constructor B.");
}
public B(string s):base(s){
Console.WriteLine("Constructor B with parameter = {0}", s);
}
public B(string s, string t):base(s,t){
Console.WriteLine("Constructor B with parameter = {0} & {1}", s, t);
}
}
class Program
{
static void Main(string[] args)
{
B b1 = new B();
B b2 = new B("First Parameter ", "Second Parameter");
Console.Read();
}
}
}
Output:
Constructor A.
Constructor B.
Constructor A with parameter = First Parameter & Second Parameter
Constructor B with parameter = First Parameter & Second Parameter |
NOTE: This is objective type question, Please click question title for correct answer. |
NOTE: This is objective type question, Please click question title for correct answer. |
NOTE: This is objective type question, Please click question title for correct answer. |
|
The assembly manifest is providing information to the .NET application at runtime. It provides the information like assembly's name, version, requested permissions, and other assemblies that the .NET application references.
It describes the assembly to the managed hosting environment.
It acts as a directory to the modules, types, and resources in the assembly. |
The application manifest which gives information to the operating system, such as in which way the assembly should be deployed and will check whether administrative elevation is required or not.
This is processed before the .NET-managed hosting environment loads to the assembly. |
NOTE: This is objective type question, Please click question title for correct answer. |
NOTE: This is objective type question, Please click question title for correct answer. |
NOTE: This is objective type question, Please click question title for correct answer. |
NOTE: This is objective type question, Please click question title for correct answer. |
NOTE: This is objective type question, Please click question title for correct answer. |
lock keyword basically provides a shortcut to Enter method of Monitor class.
Monitor is used to provide thread synchronization.It means till the Thread in which the method is being used finishes its task, no other thread can access the object.
example:
lock (object)
{
}
It is compiled into
Monitor.Enter(object);
try
{
//code
}
finally
{
Monitor.Exit(object);
}
See the MSIL of the assembly.
We can write much more code and perform customization in the try block. |