The Func class has a method:

 public static void Test(ref string test) { test = "тест"; } 

On the form I do this:

 Func.Test(ref lbStatus.Text); 

I get the error: "Property, indexer or dynamic member can not be passed as a parameter with the keyword out or ref"

I tried this:

 string test1; Func.Test(ref test1); 

I get the error: "Using local variable" test1 ", which is not assigned a value"

Actually, how can I return the test variable to the label from the method?

  • one
    string test1 = null; Func.Test(ref test1); - PetSerAl
  • @PetSerAl, thanks, your version is also working. - Maxim

1 answer 1

 string test1;// Инициализацию надо сделать.Присвойте test1 = lbStatus.Text; Func.Test(ref test1); 
  • Thanks, it helped. - Maxim