I have an automatic property
public int GearCount { get; set; }
when i try to initialize it like this-
Tandem t = new Tandem(GearCount = 5);
It gives an error as below
The name ‘GearCount’ does not exist in the current context
Whats wrong here ?
Also if i do normal intantiation it works fine.
Tandem t = new Tandem();
We need the rest of your codeYou show us an auto-property called
HasToolkitbut the problem you’re having has nothing to do withHasToolkit.It doesn’t look like you have an auto-property on your
Tandemclass calledGearCount.With the question fixed, it looks like you might just have some syntax issues.
If your
Tandemclass looks like:Then your initialization code would be:
Or: