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

  • Home
  • SEARCH
  • 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 8353429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:15:26+00:00 2026-06-09T09:15:26+00:00

I try to send some object to a function but seems C# doesn’t like

  • 0

I try to send some object to a function but seems C# doesn’t like that. This is the code.

string[] bkgrSource = new string[12];
Texture2D[] bkgrBANK = new Texture2D[12];

which bkgrSource[0] is an array of filenames and bkgrBANK[0] is an array of Texture2D.

This function is not working. The bkgrBANK[0] will remains empty. Any help?

commonImageLoader( bkgrSource[0], bkgrBANK[0] ); 

private void commonImageLoader(string source, Texture2D destination ) {
    if ( !string.IsNullOrEmpty( source ) ) {
        fileName = source;
        using ( fileStream = new FileStream( @fileName, FileMode.Open ) ) {
        destination = Texture2D.FromStream( GraphicsDevice, fileStream );
        }
    }
}
  • 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-09T09:15:28+00:00Added an answer on June 9, 2026 at 9:15 am

    I’m not a C# guru, but I think the point is that you are passing parameter by value (default method call behavior),
    So source and destination parameters in your function are a copy of the original ones.

    I think you can pass parameter by reference to solve this issue.
    Probably this should work:

    commonImageLoader( ref bkgrSource[0], ref bkgrBANK[0] ); 
    
    private void commonImageLoader(ref string source, ref Texture2D destination ) {
        if ( !string.IsNullOrEmpty( source ) ) {
            fileName = source;
            using ( fileStream = new FileStream( @fileName, FileMode.Open ) ) {
            destination = Texture2D.FromStream( GraphicsDevice, fileStream );
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i try to send some data to my php file from ajax , but
I try to send a sms using next code, but recipient gets my message
the XMLHttpRequest object causes two TCP SYN Packets when I try to send some
i run some code to connect to a server, send it an Object and
I have some code below. This code is a basic push/pop stack class that
Im getting a connection refused when I try to send some data to my
I try to send an email, but I have a problem, however, I found
I try to send a request to my server via GET, but qooxdoo sends
i try to send data to my php scripts but i think i miss
i try to send my datas to php with ajax but there's strange mistake.

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.