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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:45:34+00:00 2026-06-17T10:45:34+00:00

I’m making a library which will perform operations to read a processes memory, and

  • 0

I’m making a library which will perform operations to read a processes memory, and get information from said process.

The problem I have is that to call the functions, I have to pass a lot of the variables every time, even if their values haven’t changed.

For instance, ReadProcessMemory requires me to pass:

  • Process Handle
  • Memory Address
  • Main Module Base Address
  • Amount of bytes to read

The only thing that will be changing for each read is the Memory Address, so I don’t really need to pass the rest of the variables every time I call the function (I actually have 3 functions which can be reduced in this way, and may have more shortly).

Could anyone give me a brief explanation as to how I should go about this? Will the variables exist at runtime so I can just call the function and use them directly from the DLL file?

  • 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-17T10:45:35+00:00Added an answer on June 17, 2026 at 10:45 am

    You can use named parameters when calling methods with optional parameters.

    public void MyMethod(string s = null, int i = 0, MyType t = null)
    { 
        /* body */ 
    }
    

    Call it like so:

    MyMethod(i: 10, t: new MyType());
    MyMethod("abc");
    MyMethod("abc", t: new MyType());
    

    Alternatively you could use overloads:

    public void MyMethod(string s)
    {
        MyMethod(s, 0, null);
    }
    public void MyMethod(int i)
    {
        MyMethod(null, i, null);
    }
    public void MyMethod(MyType t)
    {
        MyMethod(null, 0, t);
    }
    public void MyMethod(string s = null, int i = 0, MyType t = null)
    { 
        /* body */ 
    }
    

    Yet another option is to use a parameters class like so:

    public class MyParametersClass
    {
        public string s { get; set; }
        public int i { get; set; }
        public MyType t { get;set; }
    
        public MyParametersClass()
        {
            // set defaults
            s = null;
            i = 0;
            MyType = null;
        }
    }
    
    public void MyMethod(MyParametersClass c)
    { 
        /* body */ 
    }
    

    Calling like so:

    MyMethod(new MyParametersClass 
    {
        i = 25,
        t = new MyType()
    });
    

    Using the parameters class is likely your preferred approach. The parameters class can be carried around as you process whatever you’re processing. 🙂 Any changes made to it will not be lost…

    var parameters = new MyParametersClass();
    MyMethod(parameters);
    parameters.i = 26;
    MyMethod(parameters);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.