C# Error CS0748 – Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit

C# Error

CS0748 – Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit

Reason for the Error & Solution

Inconsistent lambda parameter usage; parameter types must be all explicit or all implicit.

If a lambda expression has multiple input parameters, some parameters cannot use implicit typing while others use explicit typing.

To correct this error, either omit all parameter type declarations or explicitly specify the type of all parameters.

Example

The following code generates CS0748, because, in the lambda expression, only alpha is given an explicit type:

class CS0748  
{  
    System.Func<int, int, int> d = (int alpha, beta) => beta / alpha;
}  

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...