Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="list"></param>
        /// <param name="englishLetter"></param>
        /// <param name="persianLetters">Must be sorted based on their weights</param>
        public static void Update(this List <PinglishString> list, char englishLetter, List <string> persianLetters)
        {
            int count = list.Count;

            while (count > 0)
            {
                PinglishString original = list[0];
                foreach (var value in persianLetters)
                {
                    PinglishString fs = original.Clone();
                    fs.Append(value, englishLetter);
                    list.Add(fs);
                }

                list.RemoveAt(0);

                --count;
            }
        }
Beispiel #2
0
        public static void Update(this List <PinglishString> list, char englishLetter, Dictionary <string, double> persianLetters)
        {
            if (persianLetters.Count == 0)
            {
                return;
            }

            int count = list.Count;

            while (count > 0)
            {
                PinglishString original = list[0];
                foreach (var value in persianLetters.OrderByDescending(item => item.Value))
                {
                    PinglishString fs = original.Clone();
                    fs.Append(value.Key, englishLetter);
                    list.Add(fs);
                }

                list.RemoveAt(0);

                --count;
            }
        }