A simple example of the C extension method

  • 2020-05-17 06:12:40
  • OfStack


/// <summary>
    ///  The extension class 
    /// </summary>
    public static class Extend
    {
        /// <summary>
        ///  extension Join methods 
        ///  Split the array 
        ///  Capture the last 1 position 
        /// </summary>
        /// <param name="s"></param>
        /// <param name="separotor"> Space character </param>
        /// <param name="value"> An array of </param>
        /// <returns></returns>
        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;
            }
        }
    }

Related articles: