I’m using c# in vs2010, and learning oop; my first attempt at declaring the object submission in my appCode folder keeps giving me the error message that
this member defined more than once
ambiguity between Submission.SubmissionId and Submission.SubmissionId
This error throws on each variable (CustId, BroId, Coverage). I followed a model I found in a tutorial for the syntax; is that the issue? Code below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class Submission
{
int SubmissionId;
int CustId;
int BroId;
int Coverage;
//Array Product[] products;
public Submission() {}
public int SubmissionId
{
get { return SubmissionId; }
set { SubmissionId = value; }
}
public int CustId
{
get { return CustId; }
set { CustId = value; }
}
public int BroId
{
get { return BroId; }
set { BroId = value; }
}
public int Coverage
{
get { return Coverage; }
set { Coverage = value; }
}
}
The problem is you are giving the same name to the variable and the property.
You can fix it by giving them different names:
Read How to best name fields and properties.
Also, you can use Auto-Implemented Properties :
Here we go: