c# - Comma seperated textbox value to list/array of strings - Is there a better way to write this code? -


I want to create an array / list of strings of strings separated by a comma (file extension) in the test box .

For the following block of code:

  string = textbox1 as a dim CSV. Lesson "," while CSV Index (".") & Lt; & Gt; -1 lstOfStrings.Add (csv.Substring (0, csv.IndexOf (",")) csv = csv.Remove (0, csv.IndexOf (",") + 1) end while  

Output is:

Textbox 1. Text = ".exe, .php"

Listoffring = {".exe", ".php"}

Is there a better way to write this code?

A Better Way Method:

  Modify LstOfStrings () In String = Textbox 1.Text.Split ("," c)  

Comments