question

JagjitSaini-0360 avatar image
0 Votes"
JagjitSaini-0360 asked ChaoDeng-MSFT commented

Error } required


Hi

    public class Common
     {
         public Common()
         {
             public static string connectionString = ConfigurationManager.ConnectionStrings["Cnn"].ConnectionString;
         }
     }

Thanks

dotnet-aspnet-mvc
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You are not following proper C# syntax and you did not explain what you are trying to do. I assume you want the following pattern.


     public class Common
     {
         public string connectionString { get; set; }
         public Common()
         {
             connectionString = ConfigurationManager.ConnectionStrings["Cnn"].ConnectionString;
         }
     }
0 Votes 0 ·

Hi @JagjitSaini-0360 ,
In order to better help you, can you explain your needs and what needs to be done?

0 Votes 0 ·

1 Answer

DuaneArnold-0443 avatar image
0 Votes"
DuaneArnold-0443 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.