I\'m trying to make a manual setter/getter method in C#, but i\'m getting the following error from the \"set\"-line: Error: The best overloaded method match for \'System.Col
With a getter/setter the input and output types must be the same. (hence the declaration being public List
- it is expecting an input of List
and an output of List
.
What you are doing here is trying to get
type List
and set
type Package
. This is not allowed.
What I think you want to do is the following:
private List packages = new List();
public List Packages
{
// no setter
get { return packages; }
}
Then call myObject.Packages
to get all the packages and myObject.Packages.Add(package)
to add.