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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:29:08+00:00 2026-06-05T23:29:08+00:00

Info: Apologies in advance as im not sure if my explanation will be sufficient.

  • 0

Info: Apologies in advance as im not sure if my explanation will be sufficient. Im trying to get my head around how a genetic algorithm would be written. Below explanation is the general part im not sure about which someone with a reasonable amount of c# experience should be able to answer as its not GA specific knowledge.

Question:
I need to write a method (Manager_Method) whose main purpose is to pass in different combination of parameters to a second method (Computation_Method) which, using those input values, returns a result.

The tricky part comes with the fact that Manager_Method needs to be able to determine what parameters are required for the selected Computation_Method (There will be several Computation_Methods each with a different number/type of inputs).

So im wondering if someone knows of some slick way that to get around this, bar having to hard code in to an array, what the inputs are for each Computation_Method. Which would require a recompile each time i added a new Computation_Method.

Thanks in advance.

Edit: XML might be an idea. The thing im trying to get away from is hard coding in the parameters. What im trying to avoid is recompiling in the event i added a new Computation_Method AND also somehow get allow the Manager method to know what parameters are required for each Computation_Method. I figured there would be some way of doing this.

  • 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-06-05T23:29:10+00:00Added an answer on June 5, 2026 at 11:29 pm

    Not sure I understand your question but looks like you can use Reflection here. In particular MethodInfo class and its GetParameters method. Here is how I would do it:

    public class A
    {
        public void MyMethod(int integer, string str)
        {
        }
    }
    
    void Main()
    {
        System.Reflection.MethodInfo method = typeof(A).GetMethod("MyMethod");
        ParameterInfo[] pars = method.GetParameters();
        foreach (ParameterInfo p in pars) 
        {
            Console.WriteLine(p.Name + ": " + p.ParameterType);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a simple one but I cant get my head around it.
Apologies in advance if this becomes a very long question... Background Info I have
Apologies if the title is not clear, I' not really sure how to explain
Info: I'm currently trying to learn template metaprogramming (by following this book ). One
I apologize in advance for not being able to supply more information, if this
I wasn't sure how to word the title to this well, apologies if the
Before I start, please accept my apologies that I'm not a mathematician and don't
I apologize if link is not the exact term for this in advance. I
Apologies for the length but I wanted to be clear. I'm trying to make
Apologies if this is overly basic, but I couldn't find much info with my

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.