You need to write a code segment that will add a string named strConn to the connection string
section of the application configuration file. Which code segment should you use?
A.
Configuration myConfig = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
myConfig.ConnectionStrings.ConnectionStrings.Add( new ConnectionStringSettings(“ConnStr1”, strConn));
myConfig.Save();
B.
Configuration myConfig =ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
myConfig.ConnectionStrings.ConnectionStrings.Add( new ConnectionStringSettings(“ConnStr1”,strConn));
ConfigurationManager.RefreshSection( “ConnectionStrings”);
C.
ConfigurationManager.ConnectionStrings.Add( new ConnectionStringSettings(“ConnStr1”,strConn));
ConfigurationManager.RefreshSection( “ConnectionStrings”);
D.
ConfigurationManager.ConnectionStrings.Add( new ConnectionStringSettings(“ConnStr1”,strConn));
Configuration myConfig = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
myConfig.Save();
A
I agree with the answer. A