开发者

.Net - using method extensions? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improv开发者_开发百科e this question

Is 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) {

}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜