I've recently started learning C# and now I am making a Windows Form Application.
First I have an array of int here:
int[] myArray = new int[] {1, 2, 3, 4, 5, 6, 7};
and also, I want to read the value (int) that user entered. Here I declare it as below.
int userInput = Textbox.Text;
What I want to do with these two things is, among the values in myArray
, I want to find out the closest one to the value of userInput
.
And I want to store the closest number in another array, because I will repeat the this same action for several times and analyze which number came up most often.
I apologize for my unclear explanation, I'm still learning English. Thank you!