Answer to Question #16934 in C# for Chad
Here is an example in C#.
First of all you should create an array where all your strings will be saved.& Class List is a powerful implementation of a dynamic array. It represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.
& private static List<string> myDynamArray = new List<string>() ;
Now you should enter some sting in a field (textbox). I called it MyTextBox. After you click the button (Add_btn) the code below will be done:
if (myDynamArray.Contains(MyTextBox.Text)) // check, if our array contains inputted string
MessageBox.Show("Array already contains this string (" + MyTextBox.Text + ")"); // if it does, we show& the message
myDynamArray.Add(MyTextBox.Text); //if it don’t – we add inputed string to the array
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!