Linked Questions

0 votes
1 answer
26k views

How can i create a int array in class. And i have to add values to that array. Not to a specific key. i declared array as public int[] iArray; from function i have to insert values of i to array. ...
Sona Rijesh's user avatar
  • 1,037
-3 votes
2 answers
10k views

I want to know how to add a value to an element of an array. This is not a duplicate as i don't want to add a new elemnt or assign an entirely new value but want to edit an existing value in the array....
HappyHippo's user avatar
-4 votes
2 answers
9k views

I need to add values to my array one integer value at a time, via user input. I don't know how to ask it more clearly, but my goal is to define an integer array in Main(), then pass it to ...
chickenbiscuit's user avatar
1 vote
2 answers
2k views

I am still quite new to C sharp and right now I am trying to find out how to fill empty array using for loop. Program should ask how many numbers we want to add then it will ask for them with for loop....
Maxek's user avatar
  • 13
-1 votes
2 answers
522 views

At the beginning of my script I have this line: Color[] oldColor; Later I want to fill it with elements so in a function I wrote: for (int i = 0; i < targets.Length; i++) oldColor[i] = ...
NicknEma's user avatar
  • 498
0 votes
1 answer
514 views

I've more than two XML Document (generated through for loop, based on certain criteria) and want to store them in an array (if possible). For example: XmlDocument[] xmlDoc = {"xmlDoc1", "xmlDoc2"}; ...
A_L's user avatar
  • 579
0 votes
1 answer
379 views

I'm new with unity and c#. I have a class with subclass as below. Now I want to add new data inside the list of friends. [Serializable] public class PlayerData { public string playerName; ...
user7356972's user avatar
2 votes
1 answer
223 views

Let's say I have a completely empty array int num = 1; int[] arr = new int[0]; I just want to add the variable num to the arrat in the next possible position, like the .Add function for lists in C#. ...
BORBZABY's user avatar
0 votes
1 answer
98 views

With these classes. How would I add a new widget with a few components? The Component cannot be a List< Component> as the real world models are from a web service that has that structure. I've ...
NoIdea's user avatar
  • 16
0 votes
0 answers
76 views

int[] arry = { 23, 34,10, 11, 56 }; int[] Output = { }; for (int i = 0; i < arry.Length; i++) { int temp= arry[i]; for (int j = 0; j < ...
Salar Ahmadpoor's user avatar
453 votes
41 answers
337k views

In C#/VB.NET/.NET, which loop runs faster, for or foreach? Ever since I read that a for loop works faster than a foreach loop a long time ago I assumed it stood true for all collections, generic ...
223 votes
12 answers
174k views

.NET has a lot of complex data structures. Unfortunately, some of them are quite similar and I'm not always sure when to use one and when to use another. Most of my C# and VB books talk about them to ...
Pretzel's user avatar
  • 8,331
11 votes
10 answers
191k views

I would like to programmatically add or remove some elements to a string array in C#, but still keeping the items I had before, a bit like the VB function ReDim Preserve.
Cippo's user avatar
  • 1,011
1 vote
3 answers
4k views

I'm doing a windows form app and I need to declare empty array for some listbox operations. But i can't add value to array. When I try to print the lenght of the array after adding a value I reading ...
user avatar
-1 votes
2 answers
4k views

I have below array of type object object[] myarray = new object[] { "1", "Success"}; I want to insert string value at first position in myarray is there any method to do this result should be like ...
ND's's user avatar
  • 2,247

15 30 50 per page