I have a method which returns a string. I want to use this string in a thread.
private string Serialno()
{
    if (cbSerials.SelectedValue!=null)
    {
        string serial = cbSerials.SelectedValue.ToString();
        return serial;
    }
    else
    {
        return String.Empty;
    }
}
The thread,
private void CallAdb(string a, string b, string c, int x, int y, FormWindowState windowstate = FormWindowState.Normal)
{
    var filename = "cmd.exe";
    var arguments = "/C " + a + " tools\\adb " + Serialno() + " " + b;
    var startInfo = new ProcessStartInfo
    {
        FileName = filename,
        Arguments = arguments,
        UseShellExecute = false,
        CreateNoWindow = true,
        RedirectStandardOutput = true
    };
    var process = new Process { StartInfo = startInfo };
    process.Start();
    string s = process.StandardOutput.ReadToEnd();
    ToViewer(s, c, x, y, windowstate);
    process.StandardOutput.Dispose();
}
I know the is something like:
if (InvokeRequired)
But after 2 hours searching and trying, I do not get it.
 
     
     
     
    