当前位置: 首页>>代码示例>>C#>>正文


C# StringCollection.AddRange方法代码示例

本文整理汇总了C#中System.Collections.Specialized.StringCollection.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# StringCollection.AddRange方法的具体用法?C# StringCollection.AddRange怎么用?C# StringCollection.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Specialized.StringCollection的用法示例。


在下文中一共展示了StringCollection.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFilesMostDeep

        /// http://jeanne.wankuma.com/tips/csharp/directory/getfilesmostdeep.html
        /// ---------------------------------------------------------------------------------------
        /// <summary>
        ///     指定した検索パターンに一致するファイルを最下層まで検索しすべて返します。</summary>
        /// <param name="stRootPath">
        ///     検索を開始する最上層のディレクトリへのパス。</param>
        /// <param name="stPattern">
        ///     パス内のファイル名と対応させる検索文字列。</param>
        /// <returns>
        ///     検索パターンに一致したすべてのファイルパス。</returns>
        /// ---------------------------------------------------------------------------------------
        public static string[] GetFilesMostDeep(string stRootPath, string stPattern)
        {
            // ファイルリスト取得開始をデバッグ出力
            Debug.Print(DateTime.Now + " Started to get files recursivery.");

            StringCollection hStringCollection = new StringCollection();

            // このディレクトリ内のすべてのファイルを検索する
            foreach (string stFilePath in Directory.GetFiles(stRootPath, stPattern))
            {
                hStringCollection.Add(stFilePath);
                Debug.Print(DateTime.Now + " Found image file, Filename = " + stFilePath);
            }

            // このディレクトリ内のすべてのサブディレクトリを検索する (再帰)
            foreach (string stDirPath in Directory.GetDirectories(stRootPath))
            {
                string[] stFilePathes = GetFilesMostDeep(stDirPath, stPattern);

                // 条件に合致したファイルがあった場合は、ArrayList に加える
                if (stFilePathes != null)
                {
                    hStringCollection.AddRange(stFilePathes);
                }
            }

            // StringCollection を 1 次元の String 配列にして返す
            string[] stReturns = new string[hStringCollection.Count];
            hStringCollection.CopyTo(stReturns, 0);

            // ファイルリスト取得終了をデバッグ出力
            Debug.Print(DateTime.Now + " Finished to get files recursivery.");

            return stReturns;
        }
开发者ID:f97one,项目名称:PictureImporter,代码行数:46,代码来源:MainForm.cs

示例2: FilterMatches

        /// <summary>
        /// Compares two datatables and filters out all matching rows. The columns in the two tables must be the same.
        /// </summary>
        /// <param name="source">The source table to compare.</param>
        /// <param name="destination">The destination table to compare.</param>
        /// <param name="keycolumns">The column that identifies the row.</param>
        /// <param name="ignorecolumns">A collection of columns to ignore when comparing.</param>
        public static void FilterMatches(DataTable source, DataTable destination, string[] keycolumns, string[] ignorecolumns)
        {
            StringCollection ignorecols = new StringCollection();
            if(ignorecolumns != null)
                ignorecols.AddRange(ignorecolumns);

            for(int i = source.Rows.Count - 1; i >= 0; i--) {
                DataRow sourcerow = source.Rows[i];

                // Locate the row in the destination table
                string select = string.Empty;
                foreach(string keycolumn in keycolumns) {
                    select += string.Format("{0}='{1}' AND ", keycolumn, sourcerow[keycolumn]);
                }
                select = select.Substring(0, select.Length - 5);
                DataRow[] rows = destination.Select(select);		// Select matching rows
                if(rows.Length > 0) {
                    DataRow destrow = rows[0];
                    if(CompareColumns(source, sourcerow, destrow, ignorecols)) {
                        // Rows are matching, remove them
                        source.Rows.Remove(sourcerow);
                        destination.Rows.Remove(destrow);
                    }
                }
            }
        }
开发者ID:pontusm,项目名称:Deployer,代码行数:33,代码来源:DataTableComparer.cs

示例3: CompilerParameters

		public CompilerParameters (string[] assemblyNames, string output, bool includeDebugInfo)
		{
			referencedAssemblies = new StringCollection();
			referencedAssemblies.AddRange (assemblyNames);
			outputAssembly = output;
			includeDebugInformation = includeDebugInfo;
		}
开发者ID:shana,项目名称:mono,代码行数:7,代码来源:CompilerParameters.cs

示例4: EnsureStatsList

        public static SPList EnsureStatsList(SPWeb web)
        {
            var list = web.Lists.TryGetList("Stats");
            if (list != null) return list;
            var teamsList = web.Lists["Teams"];
            var fields = new List<Field>
                {
                    new LookupField {Title = "Team", LookupList = teamsList.ID, Required = true, Hidden = true},
                    new Field {Title = "Time", Type = SPFieldType.DateTime, Required = true},
                    new Field {Title = "Question", Type = SPFieldType.Text, Required = false, Hidden = true},
                    new Field {Title = "Answer", Type = SPFieldType.Text, Required = false},
                    new Field {Title = "Points", Type = SPFieldType.Number, Required = false},
                    new Field {Title = "Level", Type = SPFieldType.Number, Required = false, Hidden = true},
                };
            list = BuildList(web, "Stats", fields);
            // Read items that were created by the user
            list.ReadSecurity = 2;
            // Create and Edit access: None
            list.WriteSecurity = 4;
            list.Update();

            var view = list.DefaultView;
            view.ViewFields.Delete("LinkTitle");
            view.Update();

            var titleField = list.Fields.GetFieldByInternalName("LinkTitle");
            titleField.Hidden = true;
            titleField.ShowInViewForms = false;
            titleField.Update();

            var viewFields = new StringCollection();
            viewFields.AddRange(fields.Select(field => field.Title).ToArray());
            list.Views.Add("Godmode", viewFields, null, 100, true, false, SPViewCollection.SPViewType.Html, true);
            return list;
        }
开发者ID:eirikb,项目名称:extreme-sharepoint,代码行数:35,代码来源:ListBuilder.cs

示例5: _2DA

 /// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="schema">The schema for the 2da.  The schema defines
 /// the columns contained in the 2da</param>
 public _2DA(string[] schema)
     : this()
 {
     StringCollection schemaColl = new StringCollection();
     schemaColl.AddRange(schema);
     SetSchema(schemaColl);
 }
开发者ID:BackupTheBerlios,项目名称:nwnprc,代码行数:12,代码来源:2da.cs

示例6: CreateNewsCategoryList

        /// <summary>
        /// Se chua nhung muc tin tuc, vi du: Tin Tinh Uy, Hoi Dong Nhan Dan, Thong tin lanh dao, So ban nghanh, dia phuong, doanh nghiep
        /// </summary>
        /// <param name="web"></param>
        public static void CreateNewsCategoryList(SPWeb web)
        {
            var helper = new ListHelper(web)
            {
                Title = ListsName.VietNamese.NewsCategory,
                Name = ListsName.English.NewsCategory,
                OnQuickLaunch = true
            };

            helper.AddField(new LookupFieldCreator(FieldsName.NewsCategory.English.ParentName, FieldsName.NewsCategory.VietNamese.ParentName) { LookupList = ListsName.English.NewsCategory, LookupField = FieldsName.NewsCategory.English.Heading });

            StringCollection collect1 = new StringCollection();
            collect1.AddRange(new string[] { FieldsName.NewsCategory.FieldValuesDefault.TinTuc, FieldsName.NewsCategory.FieldValuesDefault.DoanhNghiep, FieldsName.NewsCategory.FieldValuesDefault.DuLich, FieldsName.NewsCategory.FieldValuesDefault.TinhUy });
            helper.AddField(new ChoiceFieldCreator(FieldsName.NewsCategory.English.TypeCategory, FieldsName.NewsCategory.VietNamese.TypeCategory)
            {
                Choices = collect1
            });

            helper.AddField(new BooleanFieldCreator(FieldsName.NewsCategory.English.Status, FieldsName.NewsCategory.VietNamese.Status));

            SPList list = helper.Apply();

            var title = list.Fields.GetFieldByInternalName(FieldsName.Title);
            title.Title = FieldsName.NewsCategory.English.Heading;
            title.Update();

            list.EnableAttachments = true;

            list.Update();
        }
开发者ID:bebikashg,项目名称:ttqn,代码行数:34,代码来源:AllListStructure.cs

示例7: ToCollection

 public static StringCollection ToCollection(string multiline)
 {
     var collection = new StringCollection();
     var lines = GetLines(multiline);
     collection.AddRange(lines.ToArray());
     return collection;
 }
开发者ID:kohlmann0,项目名称:Resx2Xls,代码行数:7,代码来源:StringHelper.cs

示例8: ToStringCollection

 public static StringCollection ToStringCollection(string text)
 {
     string[] sep = {"\\n"};
     string[] strs = text.Split(sep, StringSplitOptions.None);
     StringCollection coll = new StringCollection();
     coll.AddRange(strs);
     return coll;
 }
开发者ID:miquik,项目名称:mkdb,代码行数:8,代码来源:PyCodeTree.cs

示例9: Clone

 /// <summary>
 /// Creates a shallow copy of the specified <see cref="StringCollection" />.
 /// </summary>
 /// <param name="stringCollection">The <see cref="StringCollection" /> that should be copied.</param>
 /// <returns>
 /// A shallow copy of the specified <see cref="StringCollection" />.
 /// </returns>
 public static StringCollection Clone(StringCollection stringCollection)
 {
     string[] strings = new string[stringCollection.Count];
     stringCollection.CopyTo(strings, 0);
     StringCollection clone = new StringCollection();
     clone.AddRange(strings);
     return clone;
 }
开发者ID:smaclell,项目名称:NAnt,代码行数:15,代码来源:StringUtils.cs

示例10: ShellCalled

 public override void ShellCalled(string identifier, string[] files)
 {
     if (identifier == "up") {
     StringCollection arr = new StringCollection();
     arr.AddRange(files);
     UploadFiles(arr);
       }
 }
开发者ID:jamesmanning,项目名称:Clipupload,代码行数:8,代码来源:Zippyshare.cs

示例11: MyStringCol

        public static void MyStringCol()
        {
            StringCollection MyStringCol = new StringCollection();
            String[] myArray = new String[] { "NumberOfLines", "Line", "DownsAfterLine" };
            MyStringCol.AddRange(myArray); //Copies the Array "myArray" to the End of the StringCollection "MyString"

            Console.WriteLine("Initial contents of the StringCollection:");
            PrintValues(MyStringCol);
        }
开发者ID:Alpin,项目名称:FirstSteps,代码行数:9,代码来源:MyStringCollection.cs

示例12: BuildPropertySet

        protected void BuildPropertySet(Type p, StringCollection propertySet)
        {
            if (TypeToLdapPropListMap[this.MappingTableIndex].ContainsKey(p))
            {
                Debug.Assert(TypeToLdapPropListMap[this.MappingTableIndex].ContainsKey(p));
                string[] props = new string[TypeToLdapPropListMap[this.MappingTableIndex][p].Count];
                TypeToLdapPropListMap[this.MappingTableIndex][p].CopyTo(props, 0);
                propertySet.AddRange(props);
            }
            else
            {
                Type baseType;

                if (p.IsSubclassOf(typeof(UserPrincipal)))
                {
                    baseType = typeof(UserPrincipal);
                }
                else if (p.IsSubclassOf(typeof(GroupPrincipal)))
                {
                    baseType = typeof(GroupPrincipal);
                }
                else if (p.IsSubclassOf(typeof(ComputerPrincipal)))
                {
                    baseType = typeof(ComputerPrincipal);
                }
                else if (p.IsSubclassOf(typeof(AuthenticablePrincipal)))
                {
                    baseType = typeof(AuthenticablePrincipal);
                }
                else
                {
                    baseType = typeof(Principal);
                }

                Hashtable propertyList = new Hashtable();

                // Load the properties for the base types...
                foreach (string s in TypeToLdapPropListMap[this.MappingTableIndex][baseType])
                {
                    if (!propertyList.Contains(s))
                    {
                        propertyList.Add(s, s);
                    }
                }

                // Reflect the properties off the extension class and add them to the list.                
                BuildExtensionPropertyList(propertyList, p);

                foreach (string property in propertyList.Values)
                {
                    propertySet.Add(property);
                }

                // Cache the list for this property type so we don't need to reflect again in the future.                                
                this.AddPropertySetToTypePropListMap(p, propertySet);
            }
        }
开发者ID:chcosta,项目名称:corefx,代码行数:57,代码来源:ADStoreCtx_Query.cs

示例13: GetDataObject

 public static DataObject GetDataObject(IEnumerable<string> paths, bool includeAsText = true)
 {
     var dataObject = new DataObject();
       var pathCollection = new StringCollection();
       pathCollection.AddRange(paths.ToArray());
       dataObject.SetFileDropList(pathCollection);
       if (includeAsText)
     dataObject.SetText(string.Join(Environment.NewLine, paths));
       return dataObject;
 }
开发者ID:jeffton,项目名称:PFSearch2,代码行数:10,代码来源:ShellTools.cs

示例14: ToAppBoolean

        public static bool ToAppBoolean(object mDbBoolean)
        {
            StringCollection BooleanTrueValues = new StringCollection();
            BooleanTrueValues.AddRange(new string[] { "1", "S", "Y", "T", "V", "TRUE", "VERDADERO" });

            if (BooleanTrueValues.Contains(mDbBoolean.ToString().ToUpper()))
                return true;

            return false;
        }
开发者ID:jcrajat,项目名称:DAL_Design,代码行数:10,代码来源:AppTypes.cs

示例15: ProcessView

        protected void ProcessView(object modelHost, SPList targetList, ListViewDefinition viewModel)
        {
            var currentView = targetList.Views.FindByName(viewModel.Title);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioning,
                Object = currentView,
                ObjectType = typeof(SPView),
                ObjectDefinition = viewModel,
                ModelHost = modelHost
            });

            if (currentView == null)
            {
                var viewFields = new StringCollection();
                viewFields.AddRange(viewModel.Fields.ToArray());

                // TODO, handle personal view creation
                currentView = targetList.Views.Add(viewModel.Title, viewFields,
                            viewModel.Query,
                            (uint)viewModel.RowLimit,
                            viewModel.IsPaged,
                            viewModel.IsDefault);
            }

            // viewModel.InvokeOnDeployingModelEvents<ListViewDefinition, SPView>(currentView);

            // if any fields specified, overwrite
            if (viewModel.Fields.Any())
            {
                currentView.ViewFields.DeleteAll();

                foreach (var viewField in viewModel.Fields)
                    currentView.ViewFields.Add(viewField);
            }

            // viewModel.InvokeOnModelUpdatedEvents<ListViewDefinition, SPView>(currentView);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioned,
                Object = currentView,
                ObjectType = typeof(SPView),
                ObjectDefinition = viewModel,
                ModelHost = modelHost
            });

            currentView.Update();
        }
开发者ID:nklychnikov,项目名称:spmeta2,代码行数:54,代码来源:ListViewModelHandler.cs


注:本文中的System.Collections.Specialized.StringCollection.AddRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。