Answer
Use IFS's documented syntax for referencing form data as parameters on an 'external program' type custom menu — the referenced field value (e.g. payroll_id) gets passed to the external application as a command-line argument, which you then read in your C# application the same way you'd read any other command-line parameter in a normal .NET console/WinForms app.