TinyCLR 0.10 - no String.Contains()?

Any chance we could get String.Contains() implementation added?

image

I think “Contains” just calls IndexOf internally so you could add it yourself via an extension method if you wanted.

    public static class StringExtensions
    {
        public static bool Contains(this string s, string value)
        {
            return s.IndexOf(value) >= 0; // No null reference checking or comparrison method
        }
    }

Thanks, I was using IndexOf() >= 0 directly in all the various locations… that is cleaner at least :slight_smile:

1 Like