I need to join 2 Arrays type string and that all the data remain in a single arrangement it sounds like it can be done but I do not know how to achieve this
I need to join 2 Arrays type string and that all the data remain in a single arrangement it sounds like it can be done but I do not know how to achieve this
Two more methods, using the Concat
method and also an additional form, creating an array with the longitud de la primera cadena + longitud de la segunda
, then copying the first array from the 0 position, and the second array starting from the end position of the first chain all this using the method CopyTo
string[] arr = new string[] { "HOLA" };
string[] arr1 = new string[] { "MUNDO" };
string[] result= arr.Concat(arr1).ToArray();
string[] result = new string[arr.Length + arr1.Length];
arr.CopyTo(result, 0);
arr1.CopyTo(result, arr.Length);
You can do it with the following using LINQ :
string[] result = array1.Union(array2).ToArray();
You must be careful because union
removes the repeated data.
It can be done through a list:
int[] arreglo1 = new int [] { 1, 2, 3};
int[] arreglo2 = new int [] { 6, 7, 9};
List<int> lista = new List<int>(); //declaración de la lista
lista.AddRange(arreglo1); //utilizar metodo AddRange para cada arreglo
lista.AddRange(arreglo2);
int[] z = lista.ToArray(); //conviertes la lista a arreglo
Hi, I have a very silly question maybe I have a rich text box that will occupy a thousand string data and that data may vary I want to store them in an array so that when I want to search for it, I can do it just by entering the number of the array where is 499 for example and show it in my second rich text box. Grateful for the help