"string.contains()" in .NETMF

Is there any way that I can do string.Contains() in .NETMF ?

The cheapest way is just to use .IndexOf(…) != -1

@ mcalsyn - Thanks man… I found the below code similar to your - works fine.

using System;
 
namespace System.Runtime.CompilerServices
{
    [AttributeUsage(AttributeTargets.Assembly |
        AttributeTargets.Class |
        AttributeTargets.Method)]
    public sealed class ExtensionAttribute : Attribute
    { }
}
//This allows creation of extension methods in the usual way:

public static class Utils
{
    public static bool StartsWith(this string s, string value)
    {
        return s.IndexOf(value) == 0;
    }
 
    public static bool Contains(this string s, string value)
    {
        return s.IndexOf(value) > 0;
    }
}

That code is actually incorrect at line 22. It will miss a string that contains the target pattern in the first character.

That is, (“Foo Bar Baz”).Contains(“Foo”) will return false when it should return true. Change the greater-than on line 22 to greater-than-or-equals.

And I don’t think you need the attribute class - I haven’t needed to do that in creating string extension classes, and I don’t think you need it here.

I have asked for these trivial methods to be added to netmf 4.4 to make it a bit more like the desktop.
I agree - don’t need attribute anymore (you used to)