M
mc
I have a class (shown below) used to save me retyping the Connection
initialization code and other handy things, the Code Review tool in Ms
Visual Studio is telling me that the I should "Change 'GetConnection' to
a property if appropriate"
Is it "appropriate"?
TIA
Mike
public sealed class DBHelper
{
private DBHelper() { }
public static SqlConnection GetConnection()
{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["connStr"].ConnectionString);
conn.Open();
return conn;
}
initialization code and other handy things, the Code Review tool in Ms
Visual Studio is telling me that the I should "Change 'GetConnection' to
a property if appropriate"
Is it "appropriate"?
TIA
Mike
public sealed class DBHelper
{
private DBHelper() { }
public static SqlConnection GetConnection()
{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["connStr"].ConnectionString);
conn.Open();
return conn;
}