So I have this string array of elements:
string[] words = { "My", "name", "is", "Jack" };
I want each element in this array linked to a specific value (decimal) but every single time I press a button for this elements to appear(in text) let's say in a textbox or a label I want to be able to press a second button that updates that decimal that is linked with the elements.Each element has its' own specific value (let's call it weight). I have tried with:
decimal weight1 = 0;
words[0] = Convert.ToString(weight1);
label1.Text = Convert.ToString(words[0]);
But all it does is that it assigns the value to the element (changes it) and I don't want that. I want them to appear as text but only link the element not change it, and update its' linked value on the background.
The element:
"My" is linked to weight1
The element "name" is linked to weight2, name => weight3, Jack => weight4.
How can I do that?
I am open to other suggestions if this is not possible with arrays, maybe classes or interfaces...