using System; using System.Collections.Generic; using UniLinq; namespace Sprache { internal static class StringExtensions { public static IEnumerable ToEnumerable(this string @this) { #if STRING_IS_ENUMERABLE return @this; #else if (@this == null) throw new ArgumentNullException(nameof(@this)); for (var i = 0; i < @this.Length; ++i) { yield return @this[i]; } #endif } public static string Join(string separator, IEnumerable values) { #if STRING_JOIN_ENUMERABLE return string.Join(separator, values); #else return string.Join(separator, values.Select(v => v.ToString()).ToArray()); #endif } } }