C# 拓展方法的简单实例

这篇文章介绍了C# 拓展方法的简单实例,有需要的朋友可以参考一下

复制代码 代码如下:

///
    /// 扩展类
    ///

    public static class Extend
    {
        ///
        /// 扩展Join方法
        /// 把数组分割
        /// 截取最后一位
        ///

        ///
        /// 间隔符号
        /// 数组
        ///
        public static string E_Join(this string [] value,string separotor)
        {
            string str = string.Join(separotor, value);
            if (str.Length >= 2)
            {
                return str.Substring(0, str.Length - 1);
            }
            else
            {
                return str;
            }
        }
    }

以上就是C# 拓展方法的简单实例的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 其他教程