.NET interview questions: - How can we create a delegate?
This is the .NET interview questions which you come across many a times. So
following is the answer to it with explanation.
Creating a delegate is four step process:-
• Declare a delegate.
• Create an object reference.
• Point the reference to the method.
• Invoke the method via the delegate.
Below is the code snippet for the same.
following is the answer to it with explanation.
Creating a delegate is four step process:-
• Declare a delegate.
• Create an object reference.
• Point the reference to the method.
• Invoke the method via the delegate.
Below is the code snippet for the same.
// Declare a delegate
public delegate int PointToAdd(int i, int y);
// Create a reference pointer
PointToAdd objpointer = null;
// Point to the method
objpointer = Add;
// Invoke the function/method
objpointer.Invoke(10,20); .NET interview questions: - So how does CAS actually work?
Working of CAS includes four necessary steps as process and they listed asfollows:-
• First Evidence is gathered about the assembly. In other words from where did
this assembly come? , who is the publisher etc.
• Depending on evidences the assembly is assigned to a code group. In other
words what rights does the assembly depending on the evidence gathered.
• Depending on code group security rights are allocated.
• Using the security rights the assembly is run with in those rights