Answers for "how to add to an array in C#"

C#
11

c# add element to array

private T[] AddElementToArray<T>(T[] array, T element) {
    T[] newArray = new T[array.Length + 1];
    int i;
    for (i = 0; i < array.Length; i++) {
        newArray[i] = array[i];
    }
    newArray[i] = element;
    return newArray;
}
Posted by: Guest on November-24-2020
9

c# add to array

var Freds = new [] { "Fred", "Freddy" };
Freds = Freds.Concat(new [] { "Frederick" }).ToArray();
Posted by: Guest on May-01-2020
-1

c# push numbers to array

List<int> add_list= new List<int>();
for (int i = 0; i < 400; i++)
{
   add_list.Add(value);
}
Posted by: Guest on March-03-2020
0

c# how to append in array

List<string> ls = new List<string>();
ls.Add("Hello");
Posted by: Guest on September-27-2020
0

How to add arrays in C#

int[] myVariable = new int[1,2,3];
Posted by: Guest on August-27-2021
-2

c# how to append in array

int[] terms;

for(int runs = 0; runs < 400; runs++)
{
    terms[] = runs;
}
Posted by: Guest on September-27-2020

Code answers related to "how to add to an array in C#"

C# Answers by Framework

Browse Popular Code Answers by Language