there is a requirement that we need to read some key values in our window application from app config file
for example we need to read connection string from app config file
this is our app.config file
providerName="System.Data.SqlClient" />
so for read this we have to make a method
public string connection()
{
return System.Configuration.ConfigurationManager.ConnectionStrings["pollsConnectionString"].ToString();
}
but in this you might get error is that ConfigurationManager doesnt exists in this context
so remove this simply add system.configuration namespace
but if error still exists add reference of configuration manager
No comments:
Post a Comment