Hakan Zim
Hakan Zim

Reputation: 305

How to update a class?

I have updated a class member from int to string

public Class JobRequest
{
public string DefectID { get; set; }
}

But when I try to create a class variable and reference this property from another class, it still recognizes that as int and upon compiling I am still getting error that cannot implicitly convert type string to int

 var JobRequest = new JobRequest
 {
   DefectID = DefectID
 };

Upvotes: 0

Views: 153

Answers (1)

Del
Del

Reputation: 416

I agree with Neel's answer, however I appreciate that sometimes it is not desired to have every variable in the constructor. (Although in your case, ID is probably one I would recommend is almost always in the constructor.)

I have found VS2010 to be buggy and often have to do a rebuild/clear project settings, or even a VS close and re-open. (I am still doing this for some issues in VS2012 too, so get used to it!!)

Am I right in thinking that your project will not currently build due to the variable types not matching??

Upvotes: 1

Related Questions