Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 474.3k

Inconsistent accessibility parameter:RestAPi in C#

Oct 17 2020 4:36 AM
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? 
  1. //CoinJarController  
  2.  [HttpPost]  
  3.          void AddCoin([FromBody]eCoinType coinType, [FromBody]int count = 1)  
  4.         {  
  5.               
  6.             this.coinJar.AddCoin(coinType, count); //Inconsistent accessibility parameter.  
  7.         }  
  8.   
  9. //CoinJar.cs  
  10.  public class CoinJar  
  11.         {  
  12.         private readonly Coins[] coins = Enum.GetValues(typeof(eCoinType)).Cast().Select(t => new Coins(t)).ToArray();  
  13.   
  14.         // default constructor.  
  15.         public CoinJar()  
  16.         {  
  17.   
  18.         }  
  19.   
  20.         // Add method.  
  21.          
  22.          void AddCoin(eCoinType coinType, int count = 1)  
  23.         {  
  24.             coins.First(t => t.CoinType == coinType).Amount += count;  
  25.         }  
  26. }  
 

Answers (1)