PrepAway - Latest Free Exam Questions & Answers

You need to cancel the assertion.

You are developing a class library that will open the network socket connections to computers on the network.
You will deploy the class library to the global assembly cache and grant it full trust.
You write the following code to ensure usage of the socket connections.
SocketPermission permission = new SocketPermission(PermissionState.Unrestricted); permission.Assert();
Some of the applications that use the class library might not have the necessary permissions to open the network socket connections.
You need to cancel the assertion.

PrepAway - Latest Free Exam Questions & Answers

A.
CodeAccessPermission.RevertAssert();

B.
CodeAccessPermission.RevertDeny();

C.
Permission.Deny();

D.
Permission.PermitDeny();

Explanation:
CodeAccessPermission.RevertAssert() should be used to undo a previous Assert call.
B is used to revert a previous deny call.
C & D are used to reduce the CAS permissions, they do not undo a previous Assert call.

One Comment on “You need to cancel the assertion.


Leave a Reply