The problem is that you specify the same variable name and property.
You can fix this by giving them different names:
public class Submission { public Submission() {} private int submissionId; public int SubmissionId { get{ return this.submissionId; } set{ this.submissionId = value; } } private int custId ; public int CustId { get{ return this.custId ; } set{ this.custId = value; } } private int broId ; public int BroId { get{ return this.broId ; } set{ this.broId = value; } } private int coverage; public int Coverage { get{ return this.coverage; } set{ this.coverage= value; } } }
Read What is the best way to name fields and properties .
Alternatively, you can use Authorized Properties :
In C # 3.0 and later, properties declare a property more concise when there is no additional logic required in property accessories. They also allow you to create client code for creating objects.
Here we go:
public class Submission { public Submission() {} public int SubmissionId { get; set; } public int CustId { get; set; } public int BroId { get; set; } public int Coverage { get; set; } }
source share