简体   繁体   中英

Getting an error when calling a function

I am attempting to call a function but the error I am getting is "The best overloaded method match for xxxx has some invalid arguments" . When I hover over it, I get the option to "Generate method stub..."

The code causing the error is:

 if (oCustomerDAL.VerifyCustomerLoginID(ref oSubscriber)) { } 

The related function is:

public bool VerifyCustomerLoginID(ref IAuthenticate oSystemUser)  

How can I resolve the error?

if (oCustomerDAL.VerifyCustomerLoginID(ref oSubscriber))    { }  

as the method uses the ref keyword, you need to also provide it when calling the method:

if (oCustomerDAL.VerifyCustomerLoginID(ref oSubscriber))    { }  

(OP omited the ref before edit)


Edit . You should also check what type oSubscriber is. Ensure that it implements interface IAuthenticate as this is the interface that the method you're trying to call requires.

To do this find the definition of the class for which oSubscriber is an instance and ensure that it looks something like this (C#)

public class Subscriber : IAuthenticate
{
   ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM