I have an array I I I want to search the int [0] and the int [1] intersection, so I wrote the code in this form: Here I should get value 1 as 4,8, but I'm getting 52,44 as value 1. What am I doing, what's wrong with it? OK, what are you doing, you do not have any string array that is not an ARRAGE If you do this You have But if you do not trust me, and want to make sure that you do not have any sense in your previous code, then replace In addition, you need to do this Not: You can change it like something: But still it is useless because you can: int [] com with two values being 0 and 1 (in the initial step )).
string [] arr = new string [100]; Element defines another array as
arr element:
arr [0] = {4, 8,10,11,12,14} arr [1] = {1,2,3,4,8,12, 14} .. arr [6] = some
foreach (int value1 in int intro) {// show logic}
arr [0] = "4,8,10,11,12,14"; Advent [1] = "1,2,3,4,8,12,14"; Var intersection = ARR [0]. Cutting (ARR [1]); As a result, you will find this list of characters as
arr [0] and
arr [1]
'4', ',', '8' , '1', '2' which corresponds to the integer values
52 44 56 49 50 , which is actually what you are getting.
int [,] arr = new int [100,100]; or better
list & lt; List & lt; Int & gt; Instead of strings, declare an integer matrix. & Gt; . You can not use an integer like strings, at least not in this context.
list & lt; List & lt; Int & gt; & Gt; Arr = new list & lt; List & lt; Int & gt; & Gt; (); Arr.Add (new list & lt; int & gt; {4,8,10,11,12,14}); Arr.Add (new list & lt; int & gt; {1,2,3,4,8,12,14}); Var intersection = ARR [0]. Cutting (ARR [1]);
foreach loop and See what's happening:
foreach (punching in cell value 1) {// display logic}
return to zero = convert toInt32 (com [0]. Ostring ()); Int convert a =. ToInt32 (com [1]. Ostring ());
int zero = com [0]; Int one = com [1];
arr [com] [0]] arr [com [1]]
No comments:
Post a Comment