John Donnelly
John Donnelly

Reputation: 917

Expression cannot contain implicitly-typed arrays

I have a foreach statement that I generate a collection by splitting up a text file at each "\r\n" or "\n" as follows:

foreach (var value in baiTxt.Split(new[] {"\r\n", "\n"}, StringSplitOptions.None)){ do work;}

When I try to add a Watch on baiTxt.Split(new[] {"\r\n", "\n"}, StringSplitOptions.None) I get the error "Expression cannot contain implicitly-typed arrays.

Can someone point me in the right direction please?

Upvotes: 2

Views: 1042

Answers (1)

chfumero
chfumero

Reputation: 1147

Replace this code segment.

baiTxt.Split(new[] {"\r\n", "\n"}, StringSplitOptions.None)

for

baiTxt.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.None)

Upvotes: 3

Related Questions