Hi Team
I need some help, i have a public class object(CoinJar) but the problem now it does not seem to find void AddCoin(coinType....) its throwing an error "inconsistent accessibility parameter. How do i resolve this issue?
- //CoinJarController
- [HttpPost]
- void AddCoin([FromBody]eCoinType coinType, [FromBody]int count = 1)
- {
- this.coinJar.AddCoin(coinType, count); //Inconsistent accessibility parameter.
- }
- //CoinJar.cs
- public class CoinJar
- {
- private readonly Coins[] coins = Enum.GetValues(typeof(eCoinType)).Cast
().Select(t => new Coins(t)).ToArray(); - // default constructor.
- public CoinJar()
- {
- }
- // Add method.
- void AddCoin(eCoinType coinType, int count = 1)
- {
- coins.First(t => t.CoinType == coinType).Amount += count;
- }
- }
Sachin SinghPosted Oct 17, 2020, 6:58 AM