C# Statement Error

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:

Open in new window

Full Code:
private void OpenFile(String AFileName)
            Process p = new Process();
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = AFileName;
            p.StartInfo = psi;

Open in new window

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
    End Sub

Open in new window

Please help resolve the error.

This is not homework for a class. It is self-study using books.
Who is Participating?
Russ SuterConnect With a Mentor Commented:
p.Start() is a method, not a property. Make sure you include parentheses.
Mark01Author Commented:
Thank you, Russ.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.