AddRange() public method

public AddRange ( ICollection c ) : void
c ICollection
return void
Example #1
0
 static void Main(string[] args)
 {
     ArrayList list = new ArrayList();
     list.Add(true);
     list.Add(1);
     list.Add("张三");
     list.AddRange(new int[] { 1, 2, 3, 4, 5 });
     list.AddRange(list);
     
     //list.Clear();//清空所有元素
     //list.Remove(true);//删除单个元素
     //list.RemoveAt(0);//根据下标删除元素
     //list.RemoveRange(0, 3);
     //list.Sort();//升序排列
     //list.Reverse();//反转
     //list.Insert(1, "插入的");
     //list.InsertRange(0, new string[] { "zs", "ls" });
     //bool b=list.Contains(1);
     //Console.WriteLine(b);
     list.Add("wisdom");
     if (!list.Contains("wisdom"))
     {
         list.Add("wisdom");
     }
     else
     {
         Console.WriteLine("已经有这个屌丝啦");
     }
     for (int i = 0; i < list.Count; i++)
     {
         Console.WriteLine(list[i]);
     }
     Console.ReadKey();
 }
Example #2
0
 /**
  * Appends two lists of results.
  *
  * @param l1 the first list.
  * @param l2 the second list.
  * @return the appended list.
  */
 internal static List Append(List l1, List l2)
 {
     var result = new ArrayList(l1.list.Count + l2.list.Count);
     result.AddRange(l1.list);
     result.AddRange(l2.list);
     return new List(result);
 }
Example #3
0
		public static Mnozina operator + (Mnozina a, Mnozina b)
		{
			ArrayList c = new ArrayList();
			c.AddRange(a.seznam);
			c.AddRange(b.seznam);
			return new Mnozina(c);
		}
Example #4
0
 public static void setCBItems(vdUsr.vdComboBox cbo, ICollection col1, ICollection col2, Type converter, object selected, object objDefault)
 {
     ArrayList al = new ArrayList(col1.Count + col2.Count);
     al.AddRange(col1);
     al.AddRange(col2);
     setCBItems(cbo, al, converter, selected, objDefault);
 }
Example #5
0
 public bool ExecuteAll(Course c, List<CourseDetail> cdList,List<CoursePicture> plist)
 {
     ArrayList list = new ArrayList();
     try
     {
         int course_id = GetCourseId(c);
         //獲得操作Course表的sql語句
         List<string> listStr = GetSqlByCourseDetail(cdList, course_id);
         //獲取操作圖片的sql語句
         List<string> plistStr = GetSqlByPicture(plist, course_id);
         if (listStr.Count != 0)
         {
             list.AddRange(listStr);
         }
         if (plistStr.Count != 0)
         {
             list.AddRange(plistStr);
         }
         if (list.Count != 0)
         {
             return _courseImpl.SaveAll(list);
         }
         else
         {
             return true;
         }
         
     }
     catch (Exception ex)
     {
         throw new Exception("CourseMgr-->SaveAll" + ex.Message,ex);
     }
 }
 internal bool ImportComComponent(string path, OutputMessageCollection outputMessages, string outputDisplayName)
 {
     ComImporter importer = new ComImporter(path, outputMessages, outputDisplayName);
     if (importer.Success)
     {
         ArrayList list = new ArrayList();
         if (this.typeLibs != null)
         {
             list.AddRange(this.typeLibs);
         }
         if (importer.TypeLib != null)
         {
             list.Add(importer.TypeLib);
         }
         this.typeLibs = (TypeLib[]) list.ToArray(typeof(TypeLib));
         list.Clear();
         if (this.comClasses != null)
         {
             list.AddRange(this.comClasses);
         }
         if (importer.ComClasses != null)
         {
             list.AddRange(importer.ComClasses);
         }
         this.comClasses = (ComClass[]) list.ToArray(typeof(ComClass));
     }
     return importer.Success;
 }
Example #7
0
 public ArrayList GetAllEOSData()
 {
     ArrayList arr = new ArrayList();
     arr.AddRange(_liveSweepUnitOutputs);
     arr.AddRange(_doneSweepUnitOutputs);
     return arr;
 }
Example #8
0
 public void calcLaserEnds()
 {
     ArrayList toIterate = new ArrayList();
     toIterate.AddRange(Game1.miscObjects);
     toIterate.AddRange(Game1.solidTiles);
     laserEnds[0] = 0;
     laserEnds[1] = 999999;
     laserEnds[2] = 0;
     laserEnds[3] = 999999;
     foreach (Object m in toIterate)
     {
         if ((m != this) && (m.getX() == x) && (m.blocksProjectiles()) && (m.getSolid() == true))
         {
             //calc laser end points
             if ((m.getY() > y) && (m.getY() < laserEnds[3]))
                 laserEnds[3] = m.getY() - 32;
             if ((m.getY() < y) && (m.getY() > laserEnds[2]))
                 laserEnds[2] = m.getY() + 32;
         }
         if ((m != this) && (m.getY() == y) && (m.blocksProjectiles()) && (m.getSolid() == true))
         {
             //calc laser end points
             if ((m.getX() > x) && (m.getX() < laserEnds[1]))
                 laserEnds[1] = m.getX() - 32;
             if ((m.getX() < x) && (m.getX() > laserEnds[0]))
                 laserEnds[0] = m.getX() + 32;
         }
     }
 }
    	protected override Type[] TestCases()
        {
            if (!Directory.Exists(Db4oLibrarian.LibraryPath()))
            {
                TestPlatform.GetStdErr().WriteLine("DISABLED: " + GetType());
                return new Type[] { };
            }

            ArrayList list = new ArrayList();
            list.AddRange(base.TestCases());

            Type[] netTypes = new Type[] {
                typeof(SimplestPossibleHandlerUpdateTestCase),
                typeof(GenericListVersionUpdateTestCase),
                typeof(GenericDictionaryVersionUpdateTestCase),
                typeof(DateTimeHandlerUpdateTestCase),
				typeof(DateTimeOffsetHandlerUpdateTestCase),
                typeof(IndexedDateTimeUpdateTestCase),
                typeof(DecimalHandlerUpdateTestCase),
				typeof(EnumHandlerUpdateTestCase),
                typeof(GUIDHandlerUpdateTestCase),
                typeof(HashtableUpdateTestCase),
                typeof(NestedStructHandlerUpdateTestCase),
                typeof(SByteHandlerUpdateTestCase),
                typeof(StructHandlerUpdateTestCase),
                typeof(UIntHandlerUpdateTestCase),
                typeof(ULongHandlerUpdateTestCase),
                typeof(UShortHandlerUpdateTestCase),
            };

            list.AddRange(netTypes);
        	return (Type[]) list.ToArray(typeof(Type));
        }
		public static ArrayList GetHouses( Mobile owner )
		{
			ArrayList list = new ArrayList();

			Account acct = owner.Account as Account;

			if ( acct == null )
			{
				list.AddRange( BaseHouse.GetHouses( owner ) );
			}
			else
			{
				for ( int i = 0; i < acct.Length; ++i )
				{
					Mobile mob = acct[i];

					if ( mob != null )
						list.AddRange( BaseHouse.GetHouses( mob ) );
				}
			}

			list.Sort( HouseComparer.Instance );

			return list;
		}
Example #11
0
        /// <summary>
        /// Retrieves an array of all InstanceMemento's stored by this MementoSource
        /// </summary>
        /// <returns></returns>
        public InstanceMemento[] GetAllMementos()
        {
            var list = new ArrayList();
            list.AddRange(fetchInternalMementos());
            list.AddRange(_externalMementos.Values);

            return (InstanceMemento[]) list.ToArray(typeof (InstanceMemento));
        }
Example #12
0
 public static ArrayList GetNetworkComputers()
 {
     //TODO: need to convert this to a dict possibly?  currently there can be duplicates
     ArrayList ar = new ArrayList();
     ar.AddRange(GetNetworkWin32Api());
     ar.AddRange(GetNetworkDirectoryServices());
     return ar;
 }
Example #13
0
 public ArrayList GetAllEOSData()
 {
     ArrayList arr = new ArrayList();
     arr.AddRange(_liveEOSOutput);
     arr.AddRange(_doneEOSOutput);
     arr.AddRange(_rLiveEOSOutput);
     arr.AddRange(_rDoneEOSOutput);
     return arr;
 }
Example #14
0
        public IList CreateAll()
        {
            var list = new ArrayList();

            list.AddRange(countryBuilder.BuildAll());
            list.AddRange(cityBuilder.BuildAll());

            return list;
        }
Example #15
0
 public ICollection Search(String text, int projectId)
 {
     var result = new ArrayList();
     result.AddRange(GetProjects(text, projectId));
     result.AddRange(GetMilestones(text, projectId));
     result.AddRange(GetTasks(text, projectId));
     result.AddRange(GetMessages(text, projectId));
     return result;
 }
Example #16
0
        public static Type[] Union(Type[] set1, Type[] set2)
        {
            ArrayList types = new ArrayList();

            if (set1 != null) types.AddRange(set1);
            if (set2 != null) types.AddRange(set2);

            return (Type[]) types.ToArray(typeof(Type));
        }
        /// <summary>
        /// Gets a list of NFS config files (Nfs*.xml;Nfs*.config) from AppDomain.CurrentDomain.BaseDirectory including sub-directories
        /// </summary>
        /// <param name="returnPath">should the string[] contain the path to each file</param>
        /// <returns>a string array of file names optionally including their paths</returns>    
        public static string[] GetNFSConfigFilesInBaseDirectory(bool returnPath)
        {
            ArrayList configFiles = new ArrayList();
            configFiles.AddRange(GetFileListInBaseDirectory("Nfs*.xml", returnPath));
            configFiles.AddRange(GetFileListInBaseDirectory("Nfs*.config", returnPath));
            configFiles.TrimToSize();

            return (string[]) configFiles.ToArray(typeof (string));
        }
Example #18
0
		public IList Apply(IList original) {
			ArrayList right = new ArrayList();
			foreach (Hunk hunk in this) {
				if (hunk.Same)
					right.AddRange(new Range(original, hunk.Start, hunk.Count));
				else
					right.AddRange(hunk.Right);
			}
			return right;
		}
Example #19
0
        public ArrayList GetChessPieces()
        {
            ArrayList whitePieces = white.ListPieces();
            ArrayList blackPieces = black.ListPieces();
            ArrayList mergedList = new ArrayList();
            mergedList.AddRange( whitePieces );
            mergedList.AddRange( blackPieces );

            return mergedList;
        }
Example #20
0
 private static IAppender[] GetAppenders()
 {
     ArrayList list = new ArrayList();
     list.AddRange(((log4net.Repository.Hierarchy.Hierarchy) LogManager.GetRepository()).Root.Appenders);
     foreach (ILog log in LogManager.GetCurrentLoggers())
     {
         list.AddRange(((Logger) log.Logger).Appenders);
     }
     return (IAppender[]) list.ToArray(typeof(IAppender));
 }
Example #21
0
        public ArrayList ToArrayList()
        {
            var result = new ArrayList();
            if (null != Left)
                result.AddRange( Left.ToArrayList() );
            result.Add(_key);
            if (null != Right)
                result.AddRange(Right.ToArrayList());

            return result;
        }
Example #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     var settings = new ArrayList {new {Key = "JIRA HOST", Value = JiraConfiguration.JiraHost}};
     settings.AddRange(
         FeedsConfiguration.Feeds.Select(
             config => new {Key = config.Id.ToUpper() + " PRIVATE PATH", Value = config.PrivatePath}).OrderBy(item => item.Key).ToList());
     settings.AddRange(
         FeedsConfiguration.Feeds.Select(
             config => new { Key = config.Id.ToUpper() + " PUBLIC PATH", Value = config.PublicPath }).OrderBy(item => item.Key).ToList());
     rptSettings.DataSource = settings;
     rptSettings.DataBind();
 }
Example #23
0
        private static IAppender[] GetAppenders()
        {
            var appenders = new ArrayList();

            appenders.AddRange(((Hierarchy)LogManager.GetRepository()).Root.Appenders);

            foreach (ILog log in LogManager.GetCurrentLoggers())
            {
                appenders.AddRange(((Logger)log.Logger).Appenders);
            }

            return (IAppender[])appenders.ToArray(typeof(IAppender));
        }
Example #24
0
        public ArrayList GetChildModelList(ArrayList AL)
        {
            ArrayList modelList = new ArrayList();

            for (int i = 0; i < AL.Count; i++)
            {
                ModelClass MC = (ModelClass)AL[i];

                modelList.AddRange(MC.WaveChild);
                modelList.AddRange(MC.CopyChild);

            }

            return modelList;
        }
 public static string[] AllSites()
 {
     ArrayList allSites = new ArrayList();
     allSites.AddRange(BatchSearchSites);
     string[] allSitesArray = (string[]) allSites.ToArray(typeof (string));
     return allSitesArray;
 }
		private IList ObtainListableProperties(ActiveRecordModel model)
		{
			var properties = new ArrayList();
	
			ObtainPKProperty();

			if (model.Parent != null)
			{
				properties.AddRange( ObtainListableProperties(model.Parent) );
			}
	
			foreach(var propModel in model.Properties)
			{
				if (IsNotSupported(propModel.Property.PropertyType)) continue;

				properties.Add(propModel.Property);
			}
	
			foreach(var prop in model.NotMappedProperties)
			{
				if (IsNotSupported(prop.PropertyType)) continue;

				properties.Add(prop);
			}

			return properties;
		}
Example #27
0
        static void Main(string[] args)
        {
            //string[] strArray = { "First", "Second", "Third" };
            //Console.WriteLine("This array has {0} items", strArray.Length);
            //Console.WriteLine();

            //foreach (string s in strArray) 
            //{
            //    Console.WriteLine("Array Entry: {0}", s);
            //}

            //Console.WriteLine();
            //Array.Reverse(strArray);

            //foreach (string s in strArray)
            //{
            //    Console.WriteLine("Array Entry: {0}", s);
            //}

            // Working with the ArrayList
            ArrayList strArray = new ArrayList();
            strArray.AddRange(new string[] { "First", "Second", "Third" });
            Console.WriteLine("This collection has {0} items.", strArray.Count);
            strArray.Add("string");
            Console.WriteLine("This collection now has {0} items", strArray.Count);
            foreach (string s in strArray) 
            {
                Console.WriteLine("Entry: {0}", s);
            }
            Console.ReadLine();
        }
Example #28
0
        private void PrintForm_Load(object sender, EventArgs e)
        { 
            var inif = new INIFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\eXpressPrint\\config.ini");

            if (!string.IsNullOrEmpty(inif.Read("PRINT_OPT", "AUTO")))
            {
                if (inif.Read("PRINT_OPT", "AUTO").Equals("Y"))
                    PrintAndReturn(_PrintImage);
            }


            if (!string.IsNullOrEmpty(inif.Read("PRINT_SET", "COPIES")))
            {
                var arr = new ArrayList();
               
                arr.AddRange(inif.Read("PRINT_SET", "COPIES").Split(','));

                var sortedList = arr.Cast<string>().OrderBy(item => int.Parse(item));

                foreach (var item in sortedList)
                {
                    comboBoxNumOfCopies.Items.Add(item);
                }

                comboBoxNumOfCopies.Items.Insert(0,"--Select--");
                comboBoxNumOfCopies.SelectedIndex = 0;
            }
            
            formState.Maximize(this);
            txtNumberOfCopies.Focus();
        }
        public string getRandomFromArrayList(string arrayListName, ref ArrayList aList)
        {
            ArrayList alQueued;

            if (htArrayListQueues.ContainsKey(arrayListName))
            {
                alQueued = (ArrayList)htArrayListQueues[arrayListName];

                if (alQueued.Count <= 1)
                {
                    alQueued.AddRange(aList);
                }
            }
            else
            {
                alQueued = new ArrayList();
                alQueued.AddRange(aList);
            }

            int iRandom = rnd.Next(0, alQueued.Count - 1);
            string sReturnable = alQueued[iRandom].ToString();
            alQueued.RemoveAt(iRandom);

            htArrayListQueues[arrayListName] = alQueued;

            return sReturnable;
        }
Example #30
0
        public static string Text_Decryption(string text, int bits, string encryption_key)
        {
            string result = String.Empty;
            ArrayList list = new ArrayList();

            try
            {
                RSACryptoServiceProvider rsacsp = new RSACryptoServiceProvider(bits);
                rsacsp.FromXmlString(encryption_key);
                int blockSizeBase64 = (bits / 8 % 3 != 0) ?  (((bits / 8) / 3) * 4) + 4 : ((bits / 8) / 3) * 4;
                int iterations = text.Length / blockSizeBase64;

                for (int i = 0; i < iterations; i++)
                {
                    Byte[] encrypted_bytes = Convert.FromBase64String(text.Substring(blockSizeBase64 * i, blockSizeBase64));
                    Array.Reverse(encrypted_bytes);
                    list.AddRange(rsacsp.Decrypt(encrypted_bytes, true));
                }

            }
            catch (Exception e)
            {
                result = "<Error>" + e.Message + "</Error>";
            }

            result = Encoding.UTF32.GetString((Byte[])list.ToArray(typeof(Byte)));

            return result;
        }