I am trying to work with a simple C# method but I get a "Only assignment, call, increment, decrement, and new object expressions can be used as a statement" error.
The error occurs on the following line:
private void OpenFile(String AFileName)
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = AFileName;
p.StartInfo = psi;
I am trying to convert the following VB.Net sub into a C# method:
Public Sub OpenFile(ByVal AFileName As String)
Dim psi As New ProcessStartInfo()
psi.UseShellExecute = True
psi.FileName = AFileName
Please help resolve the error.
This is not homework for a class. It is self-study using books.