Linq and regular expressions
Linq, of course, need not work in isolation. It can, for example, be combined with regular expressions to extract specific string patterns from a larger string that converts the matched results into a traversable array. This can be especially useful in processing comma-separated value files (CSV files), for example, where data is formatted inside a text file, each entry being separated by a comma character. Both Linq and regular expressions can be used to read each value into a unique array element very quickly and easily. For example, consider an RTS game where human names must be generated for new units. The names themselves are stored in a CSV format and are divided into two groups: male and female. On generating ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access