How can I associate two unidentical( arrays of different types) string arrays using C#?
Asked
Active
Viewed 1,107 times
-1
-
5Please rephrase the question:) – Petar Minchev Aug 25 '10 at 14:13
-
6`( arrays of different types) string arrays` ? Which is it ? (Try to share some code to make the question clearer) If you are using C# 4, the Zip extension method might be what you want. – driis Aug 25 '10 at 14:13
-
1could you post some (pseudo) code that gives an example of what you're trying to accomplish? – Rune FS Aug 25 '10 at 14:14
1 Answers
0
int lenght = 3;
string[] arr1 = new string [length] { "one", "two", "three", };
int[] arr2 = new int [length] { 1, 2, 3, };
string search = "two";
for (a = 0; a < lenght; a++)
{
if (arr1[a] == search)
Console.WriteLine("Element found at position {0}. The corresponding element is {1}", a + 1, arr2[a]);
}
I'm not sure if this is what you mean or not but you are better off using two dimensional arrays if you want rows and columns.

Adam Higgins
- 705
- 1
- 10
- 25