Can I create a function work like this following example (it doesn't work for real), but hope you understand what I mean.

void MyFunction()
     var loginCheck = new Action(() => {
          if(textBox1.Text == "User") {
               return true;
          } else {
               return false;

     // I would like to re-use it like this.

     if(loginCheck()) {
         // Login is OK.
Well.. I don't know how to do this action/function whatever return a true or false like this fake example. Also I would like to know how to use custom string instead of bool value, but returning bool is more important for me.