add object to List. Msg "No constructor accepts 3 args
I have a List<T> object that is a collection of custom objects and when I attempt to add my custom object to the list, it it tells me "myOject does not contain a constructor that takes 3 arguments". But the thing is that myObject has only one constructor and it DOES take 3 args.
Here's the definition for myObject.
class myObject
{
#region variables
private Int64 _id;
private Int64 _origID;
private String _name;
#endregion
#region properties
public Int64 id
{
get { return this._id; }
}
public Int64 origID
{
get { return this._origID; }
}
public String name
{
get { return this._name; }
}
#endregion
#region methods
public void myObject(Int64 id, Int64 origID, String name) // <-- Constructor
{
this._id = id;
this._origID = origID;
this._name = name;
}
#endregion
}
And here's the attempt to add it to the list:
List<myObject> obj = new List<myObject>();
for (i=0,i<cat.Count,i++){
obj.Add(new myObj(i, cat.id, cat.name)); //<-- This line throws an error at compile time as noted above
}