Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6183013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:17:42+00:00 2026-05-24T01:17:42+00:00

When I try to compile the following: public static delegate void MoveDelegate (Actor sender,

  • 0

When I try to compile the following:

public static delegate void MoveDelegate (Actor sender, MoveDirection args);

I receive, as an error: “The modifer ‘static’ is not valid for the this item.”

I’m implementing this within a singleton, with a separate class which calls the delegate. The problem is that when I use the singleton instance within the other class to call the delegate (from the identifier, not the type), I can’t do that for whatever reason, even when I declare the delegate non-static. Obviously, I can only refer to it via the type directly if and only if the delegate is static.

What is the reasoning behind this? I am using MonoDevelop 2.4.2.

update

After trying one of the suggestions with the following code:

public void Move(MoveDirection moveDir)
{
    ProcessMove(moveDir);
}

public void ProcessMove(MoveDirection moveDir)
{
    Teleporter.MoveMethod mm = new Teleporter.MoveMethod(Move); 
    moveDelegate(this, moveDir);
}

I’ve received a processing error, which states that the MoveMethod must be a type, and not an identifier.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:17:42+00:00Added an answer on May 24, 2026 at 1:17 am

    Try this:

    public delegate void MoveDelegate(object o);
    public static MoveDelegate MoveMethod;
    

    So the method-variable can be defined static. The keyword static has no meaning for the delegate definition, just like enum or const definitions.

    An example of how to assign the static method-field:

    public class A
    {
      public delegate void MoveDelegate(object o);
      public static MoveDelegate MoveMethod;
    }
    
    public class B
    {
      public static void MoveIt(object o)
      {
        // Do something
      }    
    }
    
    public class C
    {
      public void Assign()
      {
        A.MoveMethod = B.MoveIt;
      }
    
      public void DoSomething()
      {
        if (A.MoveMethod!=null)
          A.MoveMethod(new object()); 
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: public class boolq { public static void main(String[] args)
I am trying to compile the following code: public static void RequireOrPermanentRedirect<T>(this System.Web.UI.Page page,
I get the following error when I try to compile an asp.net site using
I have the following error when I try to compile my code in g+
When I try to compile Gforth 0.7.0, I get the following error: $ ./configure
Try to compile the following code in JDK7: import java.nio.file.*; public final class _DiamondSyntaxErrors
Given the following code, I try to implement the public static Point operator +(int
This is my code: public static void downloadZipFile() { String saveTo = C:\\Users\\aria\\Downloads\\Temp; try
The following doesn't compile public static T Retrieve<T>(this NameValueCollection collection, String key) where T
Sometimes when i try to build/compile a downloaded source, i get following warning: ld:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.