How do I create an extension method (F#)? [duplicate]
问题 This question already has answers here : F# extension methods in C# (4 answers) Closed 6 years ago . How do I create an extension method in F#, for example, like this C# extension: public static string Right(this string host, int index) { return host.Substring(host.Length - index); } 回答1: For an F# extension that can be called from F#: type System.String with member x.Right(index) = x.Substring(x.Length - index) Note that as of Beta 1, this doesn't result in a C#-compatible extension method.