Pchp.Library.Arrays.StringKeysToUpper C# (CSharp) Method

StringKeysToUpper() static private method

Converts string keys in PhpArray to upper case.
Integer keys as well as all values remain unchanged.
static private StringKeysToUpper ( PhpArray array ) : PhpArray
array Pchp.Core.PhpArray The to be converted.
return Pchp.Core.PhpArray
        internal static PhpArray StringKeysToUpper(PhpArray/*!*/ array)
        {
            if (array == null)
            {
                //PhpException.ArgumentNull("array");
                //return null;
                throw new ArgumentNullException();
            }

            var textInfo = System.Globalization.CultureInfo.CurrentCulture.TextInfo; // cache current culture to avoid repetitious CurrentCulture.get

            PhpArray result = new PhpArray(array.Count);
            using (var iterator = array.GetFastEnumerator())
                while (iterator.MoveNext())
                {
                    var entry = iterator.Current;
                    if (entry.Key.IsString)
                        result[textInfo.ToUpper(entry.Key.String)] = entry.Value;
                    else
                        result[entry.Key] = entry.Value;
                }
            return result;
        }