I am quite new to C# and after reading different books, documentation, experimenting with a dozen of sample programs and investing weeks of time I still cannot put my simplest program to work. I get CS0120 error message. The MSDN site gives three examples of how to generate this error but gives no hints how to avoid it. Could anyone please show me how my code could be changed so it works. Please create simplest possible solution without inserting any not absolutely necessary code, so that I could understand what I miss here without being distracted by other possibly unknown details. Many thanks!
SerialPort cPort = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
public static void Main(string args)
SerialPort cPort = new SerialPort();
cPort.DataReceived += new SerialDataReceivedEventHandler(cPort_DataReceived);
private static void cPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
string cMeldung = cPort.ReadExisting();