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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:39:01+00:00 2026-05-23T01:39:01+00:00

public string[] arrTestResults = new string[8]; public string TestName; [TestInitialize] public void SetupTest() {

  • 0
public string[] arrTestResults = new string[8];
public string TestName;
[TestInitialize]
 public void SetupTest()
    {
        // Assigning aliases to array indexes
        TestName = arrTestResults[0] = "";
    }


  public void General()
    {
        arrTestResults[0] = "Test 1: General"; // works

        TestName = "Test 1: General"; // does not work. Quick Watch says TestName = Null. WHY? 
  • 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-23T01:39:01+00:00Added an answer on May 23, 2026 at 1:39 am

    TestName is NOT an alias to arrTestResults[0].

    I’m assuming that arrTestResults is string[] and that TestName is too.

    arrTestResults[0] is a storage location whose value refers to an instance of string.

    TestName is a storage location whose value refers to an instance of string.

    TestName = arrTestResults[0] = "";
    

    does not make TestName an alias for arrTestResults[0]. Instead, it assigns to the storage location TestName and to the storage location arrTestResults[0] a reference to an instance of string that is equal to "". That is, there is a reference to "". That reference is assigned to arrTestResults[0] and to TestName. It is quite similar to

    int y = 0;
    int x = y = 17;
    

    Here, x is NOT an alias for y. We have just copied the value 17 to y and to x. In our case, the value is the reference. A reference to "" is copied to arrTestResults[0] and to TestName.

    Then

    arrTestResults[0] = "Test 1: General";
    

    assigns a new reference to the storage location arrTestResults[0].

    It’s quite like

    y = 42;
    

    And then

     TestName = "Test 1: General"; 
    

    assigns a new reference to the storage location TestName. It does not alter the value of arrTestResults[0] because these two storage locations are different. Again, this is quite like

    x = 69;
    

    This does not alter the value of y.

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

Sidebar

Related Questions

public void send_multicast(string message) { UdpClient c = new UdpClient(10102); Byte[] sendBytes = Encoding.ASCII.GetBytes(message);
public string[] SearchForMovie(string SearchParameter) { WebClientX.DownloadDataCompleted += new DownloadDataCompletedEventHandler(WebClientX_DownloadDataCompleted); WebClientX.DownloadDataAsync(new Uri( http://www.imdb.com/find?s=all&q=ironman+&x=0&y=0 )); string
lot__no is a public string Dim myDelims As String() = New String() {<beginning of
private String message = ; public String getMessage() { return message; } public void
public string[] tName = new string[]{Whatever,Doesntmatter}; string vBob = Something; string[] tVars = new
public class ProtectedClass { private String name; public static void changeName(ProtectedClass pc, String newName)
As in: public string[,] GetHelp() { return new string[,] {...things...} } And how do
public string[] TestResults = new string[8]; I want to assign each item of the
public class Buddy { public string[] Sayings; } Buddy one = new Buddy(); one.Sayings
Given public String(char*) why we cannot use the following statement? string str = new

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.