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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:01:42+00:00 2026-05-30T15:01:42+00:00

Just wondering how It could be done and I’m at a point where I

  • 0

Just wondering how It could be done and I’m at a point where I am implementing the stream.Read method. Am I missing something or there is just a ref keyword missing or what?

private void Form1_Load(object sender, EventArgs e)
{
    byte[] ex = new byte[1] { 0 };
    MessageBox.Show(ex[0].ToString());
    ok(ex);
    MessageBox.Show(ex[0].ToString());
}

private int ok(byte[] asd)
{
    asd = new byte[1] { 255 };
    return 1;
}

//first result: 0
//second result: 0
  • 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-30T15:01:44+00:00Added an answer on May 30, 2026 at 3:01 pm

    This is basically a matter of understanding two important concepts:

    • The difference between reference types and value types
    • How arguments are passed in C#

    Your ok method changes the value of the parameter – that won’t be visible to the caller, because it’s a value parameter (the argument is passed by value). However, if you were to write:

    asd[0] = 255;
    

    instead of the first line, then that change would be visible. That’s not changing the parameter itself; it’s changing the value of an element within the object that the parameter refers to.

    Basically, the value of an expression in .NET is never an object – it’s always either a value type value or a reference – a way of explaining how to get to an object.

    Suppose I hand you a piece of paper with my home address on. If you rub out that address and write on a different address, that doesn’t change where I live, does it? That’s what you’re doing when you change the parameter value. However, if you go to the address on the piece of paper and paint the front door red, then I’ll see a red front door when I come home. You haven’t changed the value on the piece of paper – you’ve made a change within the object that the value on the piece of paper refers to. That’s what Stream.Read does.

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

Sidebar

Related Questions

Just wondering if you could help wanting to produce an activity stream in Java,
Just wondering if someone could point me in the right direction of how to
I'm just wondering if someone could point me in the right direction here, I
I'm wondering how this: could be done programmatically? Is it just setting the uitableview
Hi sorry still learning here and slow to learning code arguments. Just wondering could
Just wondering if someone could help me with a very simple SQL query. I
I just wondering how I could replace the second instance of a string inside
I'm just wondering how I could display my last 200 mysql entries in php
I'm just wondering how I could remove everything after a certain substring in PHP
I’m just wondering if anyone’s come across or could recommend an IDE that’s capable

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.