static void Main(string[] args)
        {
            string[] str   = { "aaa", "bbb", "ccc" };
            UsedStrs usedS = new UsedStrs();

            string newStr = str.Take(1).ToArray()[0];
            int    len    = newStr.Length;

            usedS.UsedSet = newStr;
            var except = from q in str where str.Except(usedS.UsedGet).Contains(q) select q;

            foreach (string ss in except)
            {
                newStr += ss;
                Console.WriteLine(newStr);
                newStr = newStr.Remove(len);
            }

            foreach (string s in except)
            {
                newStr        = s;
                len           = newStr.Length;
                usedS.UsedSet = s;
                except        = from q in str where str.Except(usedS.UsedGet).Contains(q) select q;
                foreach (string ss in except)
                {
                    newStr += ss;
                    Console.WriteLine(newStr);
                    newStr = newStr.Remove(len);
                }
            }
            Console.ReadKey();
        }
Esempio n. 2
0
        public void Concat()
        {
            UsedStrs usedS  = new UsedStrs();
            var      except = str;
            string   newStr;
            int      len;

            foreach (string strNotUsedAsBeginning in except)
            {
                if (strNotUsedAsBeginning != "" && strNotUsedAsBeginning != null)
                {
                    newStr        = strNotUsedAsBeginning;
                    len           = newStr.Length;
                    usedS.UsedSet = strNotUsedAsBeginning;
                    except        = (from q in str where str.Except(usedS.UsedGet).Contains(q) select q).ToArray();
                    foreach (string strNotUsedWithThisBeginning in except)
                    {
                        if (strNotUsedWithThisBeginning != "")
                        {
                            newStr += strNotUsedWithThisBeginning;
                            Console.WriteLine(newStr);
                            newStr = newStr.Remove(len);
                        }
                    }
                }
            }
        }