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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:59:26+00:00 2026-06-16T01:59:26+00:00

What I’m trying to achieve is say i have an array, i want to

  • 0

What I’m trying to achieve is say i have an array, i want to be able to modify a specific array element throughout my code, by pointing at it.

for example in C++ i can do this

int main(){
 int arr [5]= {1,2,3,4,5};
 int *c = &arr[3];
 cout << arr[3] <<endl;
 *c = 0;
 cout << arr[3]<<endl;
}

I did some googling and there seems to be a way to do it through ‘unsafe’, but i don’t really want to go that route.

I guess i could create a variable to store the indexes, but I’m actually dealing with slightly more complexity (a list within a list. so having two index variables seems to add complexity to the code.)

C# has a databinding class, so what I’m currently doing is binding the array element to a textbox (that i have hidden) and modifying that textbox whenever i want to modify the specific array element, but that’s also not a good solution (since i have a textbox that’s not being used for its intended purpose – a bit misleading).

  • 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-16T01:59:27+00:00Added an answer on June 16, 2026 at 1:59 am

    A C# example of how you would like the use to look would help. If I understand what you’re asking, a simple class like this might do it. What you’re asking for though, doesn’t seem like a very good idea. If you showed the larger scope in which you need this, someone might be able to point out a better design where you didn’t need this sort of functionality at all.

    public class ListElement<T> {
        private IList<T> list;
        private int index;
        public ListElement(IList<T> list, int index) {
            this.list = list;
            this.index = index;
        }
        public T Value {
            get {
                return list[index];
            }
            set {
                list[index] = value;
            }
        }
    }
    

    a use of this would look like

    int[] arr = new int[] {1,2,3,4,5};
    ListElement<int> third = new ListElement<int>(arr, 2);
    Console.WriteLine(third.Value);
    third.Value = 0;
    Console.WriteLine(third.Value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to select an H1 element which is the second-child in its group
I have an array which has BIG numbers and small numbers in it. I
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.