Alex Rivera | Logout

.NET CIL Call or CallVirt?

Asked 2010-11-17T23:41:40.680
10

How can I determine if a method needs to be called with "Call" or "Callvirt"?

Edit
Report

1 Answer

6

By default, the C# compiler always uses callvirt for everything except static or value type calls. This causes implicit null checking of the 'this' (arg0) argument. You're not strictly required to follow this convention, but any virtual method on a reference type will definitely require callvirt.

answered 2010-11-17T23:54:43.400

Your Answer