时间:2020-11-19 18:01:02 | 栏目:.NET代码 | 点击:次
namespace MyExtensionMethods
{
public static class MyExtensions
{
public static int MyGetLength(this System.String target)
{
return target.Length;
}
}
}
使用时,需要引入这个名字空间,引用如下:
string str = "dafasdf"; int len = str.MyGetLength();