So I am new to C#, and I am trying to to figure out what the problem is with my code. I know this works in VB.Net just not sure why it doesn't in C#
private Connection myConnection = new Connection();
private SqlConnection mySqlConnection = new SqlConnection(myConnection.connectionString);
I am getting an error saying "A field initializer cannot reference the non-static field, method, or property" on:
new SqlConnection(myConnection.connectionString);
I am confused as to why it will not work in C#. Thanks in advance for any help.