Take the 2-minute tour ×

Many of you are familiar with Josh Smith. He does a brilliant job of explaining things, but one particular statement he makes in the article:


has me confused...

Regarding the ICommand and RelayCommand class he mentions:

One possible implementation pattern is to create a private nested class within the ViewModel class, so that the command has access to private members of its containing ViewModel and does not pollute the namespace.

Maybe because I'm new to this I'm having a hard time visualizing what he is saying. Could someone send me some pseudo code to explain this? I think seeing the code would help me grasp the concept.

share|improve this question
How do I accept? I don't see any buttons, etc.? –  Ann Sanderson Mar 12 '12 at 20:05
Click on your username to view your profile. Go to your previously asked questions. In each of those questions click the checkmark below the "up-vote" tool for the best answer to your question. –  Khan Mar 12 '12 at 20:06
Ok, thanks. I've gone through my questions and accepted the best answer. Can anyone help me with this question? –  Ann Sanderson Mar 12 '12 at 20:11
This would be a better question if you took a stab at the pseudo code yourself so we could see where your head's at. That exercise alone may be enough to give you that "aha!" moment. –  Chuck Mar 12 '12 at 20:11
@Jeff - Not the "best" answer. Only accept answers that actually helped. –  Henk Holterman Mar 12 '12 at 20:22
add comment

1 Answer

up vote 1 down vote accepted
class Foo
   private static int f;

   private class Bar  // nested class
       void B() 
          int b = f;  // access to private member of containing class

But do note the article continues without using this.

share|improve this answer
add comment

Your Answer


