public void Execute() { if (_myApplicationWideService.Has <string>("some-key")) { var someValue = _myApplicationWideService.Get <string>("some-key"); // Do something with someValue } // Do something else like: _myApplicationWideService.Set("some-key", "some-value"); // More logic here }