Just note that you want to avoid using the Lines property repeatedly if you can. Each time you access the Lines property it returns a new string array, so if you intend to use it more than once in quick succession you should only access the property once and assign its value to a local variable. You then use that variable repeatedly and thus only one string array is created. You only need to access the property value again if there's a chance that the Text has changed in between.