예제 #1
0
 public TemplateItem(Cmsitem cmsitem)
 {
     _cmsitem = cmsitem;
 }
예제 #2
0
        private Cmsitem[] RandomizeIfNeeded(List<Cmsitem> cmsItems)
        {
            // list is an ArrayList or Array in class.
            Random rand = new Random();
            Cmsitem[] array = new Cmsitem[cmsItems.Count];
            cmsItems.CopyTo(array);
            if (!this.Random)
                return array;

            int randIndex;
            Cmsitem tmpObj;
            for (int i = cmsItems.Count - 1; i >= 0; i--)
            {
                randIndex = rand.Next(i + 1);
                if (randIndex != i)
                {
                    tmpObj = array[i];
                    array[i] = array[randIndex];
                    array[randIndex] = tmpObj;
                }
            }
            return array;
        }