开发者

Can I do this with LINQ?

开发者 https://www.devze.com 2023-03-11 13:18 出处:网络
Can I do this in LINQ, specif开发者_JS百科ically the Split function on the passed in string? var lstValues = from objValue in value.Split(\'[\')

Can I do this in LINQ, specif开发者_JS百科ically the Split function on the passed in string?

var lstValues = from objValue in value.Split('[')
                where objValue != ""
                select objValue;


Looks fine, but this also looks like you just remove empty entries, you could just use the StringSplitOptions for that:

value.Split(new char[]{'['}, StringSplitOptions.RemoveEmptyEntries);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号