Reputation: 663
I have looked at all the other member defined more than once threads and could not find one that was like mine. If there is one and I missed it I am sorry. Most of what we do here is VB.NET, but I am trying to convert some existing code to C#. The problem I am having is I am getting a "This member is defined more than once" Here is my code.
private System.Data.SqlClient.SqlConnection mSqlConn;
private bool mLoadOnly = false;
public void New(bool isLoadOnly) {
mLoadOnly = isLoadOnly;
mSqlConn = new System.Data.SqlClient.SqlConnection(GetConnStr());
}
So I get the error in the constructor. I do not see how I am defining mLoadOnly or mSqlConn again. I am trying to define these as class wide variables, but C# does not seem to like this. How should I go about doing this? Thank you!
Upvotes: 0
Views: 885
Reputation: 26424
It looks like you have the constructor defined multiple times in your code file. Also, constructors in C# are declared differently, i.e.
public ClassName(...)
Check this article on MSDN:
Upvotes: 3