Hardly.StringHelpers.AppendStrings C# (CSharp) Method

AppendStrings() public static method

public static AppendStrings ( this source, string stringsToAppend, string textBetween = null ) : string[]
source this
stringsToAppend string
textBetween string
return string[]
        public static string[] AppendStrings(this object[] source, string[] stringsToAppend, string textBetween = null)
        {
            if(source != null && stringsToAppend != null && source.Length == stringsToAppend.Length) {
                string[] mergedList = new string[source.Length];

                for(int i = 0; i < source.Length; i++) {
                    if(i < stringsToAppend.Length) {
                        mergedList[i] = source[i].ToString();
                        if(textBetween != null) {
                            mergedList[i] += textBetween;
                        }
                        mergedList[i] += stringsToAppend[i];
                    } else {
                        break;
                    }
                }

                return mergedList;
            } else {
                Debug.Fail();
            }

            return null;
        }