C# Error CS1615 – Argument {0} may not be passed with the ‘{1}’ keyword

C# Error

CS1615 – Argument {0} may not be passed with the ‘{1}’ keyword

Reason for the Error & Solution

Argument ‘number’ should not be passed with the ‘keyword’ keyword

One of the keywords ref or out was used when the function did not take a ref or out parameter for that argument. To resolve this error, remove the incorrect keyword and use the appropriate keyword that matches the function declaration, if any.

The following sample generates CS1615:

// CS1615.cs  
class C  
{  
   public void f(int i) {}  
   public static void Main()  
   {  
      int i = 1;  
      f(ref i);  // CS1615  
   }  
}  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...