开发者

method group did you intend to invoke method?

I'm getting an error off of the following code asking if I want to invoke this method:

 protected void CheckForLocalPickPlace(JobList jobs)
    {
        if (CachedAnonymousMethodDelegate1 == null)
        {
            CachedAnonymousMethodDele开发者_StackOverflow中文版gate1 = new Predicate<JobClass>(null, (IntPtr) CheckForLocalPickPlace);
        }
        this.localPickPlace = jobs.TrueForAll(CachedAnonymousMethodDelegate1);
    }


I believe the problem is the way you're trying to construct the delegate, although you haven't specified much in the way of types.

You can't build a Predicate<JobClass> from CheckForLocalPickPlace because the signature is wrong, but if you could you could just do:

CachedAnonymousMethodDelegate1 = CheckForLocalPickPlace;

or

CachedAnonymousMethodDelegate1 = new Predicate<JobClass>(CheckForLocalPickPlace);

If you could give us a lot more context, we can try to help you more.


this.ClearJobs Is that a function? If it is, it should be this.ClearJobs()


Unlike some languages (e.g. Delphi), C# requires that you put the brackets after a method to call it.

IIRC, this comes from the definition of the C language where () is the operator to call a function.


This expression is invalid:

new Predicate<JobClass>(null, (IntPtr) CheckForLocalPickPlace)

If CheckForLocalPickPlace is a method, then you probably meant to put this:

new Predicate<JobClass>(CheckForLocalPickPlace)

If it is not a method, please describe in more detail what you are trying to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜