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 3429398
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:04:35+00:00 2026-05-18T07:04:35+00:00

I am creating a smaller RPG game in ASP.NET. In this game I have

  • 0

I am creating a smaller RPG game in ASP.NET. In this game I have an items architecture, where each item has some methods. For instance, all items should share a method like “Drop“, “Examine” and “Use“. Some items will have to be extended with methods like “Operate“, “Calculate” and such.

So far, I have created the following object GameActionList:

public delegate void MyDelegate();

public class GameActionList
{
    public List<MyDelegate> Items = new List<MyDelegate>();

    public void Add(MyDelegate del)
    {
        Items.Add(del);
    }

    public void CallDelegates()
    {
        foreach (MyDelegate myDelegate in Items)
        {
            myDelegate();
        }
    }
}

I have a BaseItem class, which has this GameActionList. The get property of this in the BaseItem class is like this:

    public GameActionList Actions 
    { 
        get
        {
            GameActionList actions = new GameActionList();
            actions.Add(this.Drop);
            actions.Add(this.Examine);
            return actions;
        }
    }

This is fine, BUT… I have some problems!

My problem

I need a way more generic GameActionList. I need to have a list of not only voids, but also functions.. Also, I need both methods with parameters and without parameters.

For instance: The Drop method will need a Player object, so he can Drop the item. The Examine method will need to return a string descriping the item.

Also, I need some data which I don’t know when I Initialize the GameActionList: I first know these data when I invoke the method…

So I have two questions:

  1. How do you extend the GameActionList, so it can contain a list of both voids and functions andalso these both can have parameters or not.. (AND DOES IT EVEN MAKE SENSE??)
  2. How can I give some data to the method later in the cycle, like when invoking?

Also… This might be a very stupid way to do it, so if you have some way more elegant solution.. I’m more than ready to hear it!

Thanks a lot…!
Lars

  • 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-18T07:04:36+00:00Added an answer on May 18, 2026 at 7:04 am

    you most probably need Action , Func delegates

    Func

    Action

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating a simple RPG game, first time using XNA. Trying to get my character
I'm creating some HTML elements dynamically via JavaScript. Something line this: var author =
I am creating a very basic asp.net web page to display an error message.
I'm creating a media player (mostly video but with some graphical interfaces) that has
I'm creating a tic-tac-toe game, and one of the functions has to iterate through
We're creating an iOS photo app. In doing this, we have to create dynamically
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
I creating a web application using JSF,Hibernate,Spring. I have added a filter for checking
I'm creating an installation script that I'd like to break up into smaller, more

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.