I have a class in whose field I need to hang the value obtained in the method of another class.
Those. insert data into the connection string that is read by the Config class method.
This is how it looks in practice.
It swears at me:
"field initializer cannot be used
Here is my code:
namespace DBSync { class FireBird { Config config; public FireBird(Config config) { this.config = config; } string connectionString = "User=SYSDBA;" + "Password=masterkey;" + "Database=" + config "DataSource=localhost;" + "Port=3050;" + "Dialect=3;" + "Charset=NONE;" + "Role=;" + "Connection lifetime=15;" + "Pooling=true;" + "MinPoolSize=0;" + "MaxPoolSize=50;" + "Packet Size=8192;" + "ServerType=0"; Here is the code of the part that the config reads:
namespace DBSync { public class Config { string fbLogin; string fbPass; string fbPath; string PGLogin; string PGPass; string SQLLitePath; public void parseConfig() { The question is how to do it? And why now does not work?
"Database=" + config- here lacks access to the config field and the+sign after that. - nzeemin