The most important is that the method name reflects a behavior. You do this perfectly well with the Set prefix (if your project indeed doesn’t use lower camel case for method names).
The consumers would then write something very unambiguous and self-documenting:
myobject.SetLock(true);
As a consumer, I perfectly understand that the parameter name in your interface definition reflects the intended target state that will result from the operation:
SetLock (boolean isLocked);
For the maintainers of this class, the name of the parameter will probably be understood the same way. You just should avoid any confusion with the internal state.
It is nevertheless true that the readability and clarify of the implementing code will have ups and downs:
internallyLocked = isLocked; // rather clear
if (isLocked) { ... } // rather ambiguous
If you want to improve that readability, the problem of your name is not so much the ending of your parameter but its beginning. In all objectivity:
- if the parameter starts with
is, the end should be locked for the sake of grammatical consistency;
is prefix suggests a current state when used in the method body. If you want to avoid any potential ambiguity, you could use a less ambiguous prefix to clarify the intention: either reflect a change of state, or a target state.
The exact choice of wording is opinion based. I could think for example of toBeLocked (target state clearly expressed) or willLock (change action clearly expressed). The latter has the advantage that it belongs to the usual prefixes (is, has, can, will, was, did) But there are certainly many other possibilities that comply with these basic principles.
is. why do you thinklockedis better thanlock?