.Net - using method extensions? [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improv开发者_开发百科e this questionIs it possible to use the method extensions to add methods that accept parameters ?
for example:
myString.NumberOfCharacters("a");
yes. like this
public static class StringExtensions
{
public static void NumberOfCharacters(this string someString, string param)
{
...
}
}
Check out the MDSN page of extension methods and the examples there.
Sure:
public static int NumberOfCharacters(this string str, string extraParam) {
}
精彩评论