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


C# StringList.Add方法代码示例

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


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

示例1: CustomViewEngine

        /// <summary>
        /// Constructor
        /// </summary>
        public CustomViewEngine(params string[] additionalLocations)
        {
            StringList viewLocations = new StringList();
            viewLocations.Add("~/Views/{1}/{0}.cshtml");
            viewLocations.Add("~/Views/Shared/{0}.cshtml");
            viewLocations.AddRange(additionalLocations);

            this.PartialViewLocationFormats = viewLocations.ToArray();
            this.ViewLocationFormats = viewLocations.ToArray();
        }
开发者ID:mnoreke,项目名称:MNorekePublic,代码行数:13,代码来源:CustomViewEngine.cs

示例2: Create

 public static EntityMemberMask Create(EntityInfo entity, string propertiesOrGroups)
 {
     var invalidNames = new StringList();
       var mask = new EntityMemberMask(propertiesOrGroups, entity);
       var props = propertiesOrGroups.SplitNames(',', ';');
       foreach (var name in props) {
     //first try member
     if (string.IsNullOrWhiteSpace(name))
       continue;
     var grp = entity.GetPropertyGroup(name);
     if (grp != null) {
       foreach (var m in grp.Members)
     mask.Set(m);
       continue;
     }
     var member = entity.GetMember(name);
     if (member != null) {
       mask.Set(member);
       continue;
     }
     //name is invalid
     invalidNames.Add(name);
       }
       if (invalidNames.Count > 0)
     Util.Throw("Properties/subgroups [{0}] not found in entity {1}.", string.Join(",", invalidNames), entity.EntityType);
       return mask;
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:27,代码来源:EntityMemberMask.cs

示例3: GetFirsts

 public override IList<string> GetFirsts()
 {
     var firsts = new StringList();
     foreach (var t in LineTerminators)
         firsts.Add(t.ToString());
     return firsts;
 }
开发者ID:HyperSharp,项目名称:Hyperspace.DotLua,代码行数:7,代码来源:NewLineTerminal.cs

示例4: GetValue

        public string GetValue()
        {
            StringTable table = new StringTable();

            //table.Add("LimitType", LimitType.ToString());
            table.Add("LimitType", ((byte)LimitType).ToString());


            foreach (KeyValuePair<Guid, List<Guid>> item in ExcludeRoles)
            {

                if (item.Value != null)
                {

                    StringList roles = new StringList();
                    foreach (Guid roleID in item.Value)
                    {
                        roles.Add(roleID.ToString());
                    }

                    table.Add("ExcludeRoles-" + item.Key.ToString("N"), roles.ToString());

                }

            }

            return table.ToString();
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:28,代码来源:PermissionLimit.cs

示例5: FormatSqlParameters

 public static string FormatSqlParameters(ICollection prms, string format = "{0}={1}", string delimiter = ", ", int maxValueLen = 50)
 {
     var sValues = new StringList();
       foreach (IDbDataParameter prm in prms)
     sValues.Add(FormatSqlParameter(prm, format, maxValueLen));
       var result = string.Join(delimiter, sValues);
       return result;
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:8,代码来源:LoggingExtensions.cs

示例6: Compute

 public override void Compute()
 {
     StringList list = new StringList();
     foreach (string theString in DevelopmentKit.IO.Generics.ImportStrings(_config.FileName.Absolute))
     {
         list.Add(theString);
     }
     Workspace.Store("ListOfStrings", list);
 }
开发者ID:CoEST,项目名称:TraceLab-CDK,代码行数:9,代码来源:ListStringImporter.cs

示例7: Run

        internal void Run(StringList values)
        {
            if (string.IsNullOrEmpty(Command))
            {
                return;
            }

            List<Item> items = new List<Item>();
            StringList othervalues = new StringList();

            foreach (var val in values)
            {
                ItemUri uri = ItemUri.Parse(val);
                if (uri != null)
                {
                    items.Add(Sitecore.Data.Database.GetItem(uri));
                }
                else
                {
                    othervalues.Add(val);
                }
            }

            Command command = CommandManager.GetCommand(Command);
            Debug.Assert(command != null, Command + " not found.");

            // If our command can hanlde more than one item in the context we run it once
            if (!SingleItemContext)
            {
                CommandContext cc = new CommandContext(items.ToArray());
                cc.CustomData = othervalues;
                command.Execute(cc);
            }
            //otherwise we have to generate as many commands as items
            else
            {
                if (items.Count > 0)
                {
                    foreach (var item in items)
                    {
                        CommandContext cc = new CommandContext(item);
                        command.Execute(cc);
                    }
                }
                if (othervalues.Count > 0)
                {
                    foreach (var othervalue in othervalues)
                    {
                        CommandContext cc = new CommandContext();
                        cc.CustomData = othervalue;
                        command.Execute(cc);
                    }
                }
            }
        }
开发者ID:svn2github,项目名称:AdvancedSystemReporter,代码行数:55,代码来源:CommandItem.cs

示例8: GetFirsts

 public override IList<string> GetFirsts()
 {
     StringList result = new StringList();
       result.AddRange(base.Prefixes);
       //we assume that prefix is always optional, so number can always start with plain digit
       result.AddRange(new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" });
       // Python float numbers can start with a dot
       if (IsSet(TermOptions.NumberAllowStartEndDot))
     result.Add(DecimalSeparator.ToString());
       return result;
 }
开发者ID:Temperament,项目名称:FiestaShark,代码行数:11,代码来源:NumberLiteral.cs

示例9: ToStringTest

        public void ToStringTest()
        {
            StringList target = new StringList();
            // empty list
            string expected = string.Empty;
            string actual = target.ToString();
            Assert.AreEqual(expected, actual);

            // 1 item in list
            target.Add("test1");
            expected = "test1";
            actual = target.ToString();
            Assert.AreEqual(expected, actual);

            // 2 items in list
            target.Add("test2");
            expected = "test1,test2"; 
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
开发者ID:vpuhoff,项目名称:sphinx-dotnet-client,代码行数:20,代码来源:StringList_UnitTest.cs

示例10: SetBannedSpiders

        public void SetBannedSpiders(IEnumerable<string> spiderNames)
        {
            StringList bannedNames = new StringList();

            if (spiderNames != null)
            {
                foreach (string spiderName in spiderNames)
                {
                    bannedNames.Add(spiderName);
                }
            }
            m_BannedNames = bannedNames;
            m_BannedSpiders = null;
        }
开发者ID:huchao007,项目名称:bbsmax,代码行数:14,代码来源:BannedSpiders.cs

示例11: BuildSqlInsertCommand

 //
 public override DbCommandInfo BuildSqlInsertCommand(EntityCommand entityCommand)
 {
     const string SqlInsertTemplate = @"
     INSERT INTO {0}
       ({1})
       VALUES
     ({2});
     {3}
     ";
       bool useStoredProc = this.DbModel.Config.Options.IsSet(DbOptions.UseStoredProcs);
       var table = DbModel.LookupDbObject<DbTableInfo>(entityCommand.TargetEntityInfo, throwNotFound: true);
       var idClause = string.Empty;
       var listColumns = new List<DbColumnInfo>();
       var listValues = new StringList();
       var cmdName = ModelConfig.NamingPolicy.ConstructDbCommandName(entityCommand, table.TableName, "Insert");
       var dbCmdInfo = CreateDbCommandInfo(entityCommand, cmdName, table, DbExecutionType.NonQuery, null);
       foreach (var prm in dbCmdInfo.Parameters) {
     var col = prm.SourceColumn;
     if (!col.Flags.IsSet(DbColumnFlags.NoInsert)) {
       listColumns.Add(col);
       listValues.Add(prm.Name);
     }
     // identity
     if (col.Flags.IsSet(DbColumnFlags.Identity)) {
       if (useStoredProc)
     //append to stored proc
     idClause = string.Format("SET {0} = LAST_INSERT_ID();", prm.Name);
       else
     dbCmdInfo.PostUpdateActions.Add((conn, cmd, rec) => {
       var idCmd = conn.DbConnection.CreateCommand();
       idCmd.CommandText = "Select LAST_INSERT_ID();";
       idCmd.Transaction = conn.DbTransaction;
       var id = conn.Database.ExecuteDbCommand(idCmd, conn, DbExecutionType.Scalar); //it is decimal
       var intId = Convert.ChangeType(id, prm.SourceColumn.Member.DataType);
       rec.SetValueDirect(prm.SourceColumn.Member, intId);
     });
     }//if identity
       }
      // this.ModelConfig.Options.IsSet(DbOptions.us)
       //build SQL
       var strColumns = listColumns.GetSqlNameList();
       var strValues = string.Join(", ", listValues);
       dbCmdInfo.Sql = string.Format(SqlInsertTemplate, table.FullName, strColumns, strValues, idClause);
       return dbCmdInfo;
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:46,代码来源:MySqlDbSqlBuilder.cs

示例12: FormatClosureValues

 // For cached queries, local values are passed in closure object. The problem is that a single closure is created for a method,
 // and a query might use only some of closure values. So for each field in closure we check that it is actually used in the query we report.
 private static string FormatClosureValues(string fromExpression, string paramName, object obj)
 {
     if (obj == null)
     return paramName + "=null";
       var type = obj.GetType();
       if (!type.IsAnonymousType())
     return paramName + "=" + LoggingExtensions.ToLogString(obj);
       //Anonymous type
       var fields = type.GetFields();
       var strValues = new StringList();
       for (int i = 0; i < fields.Length; i++ ) {
     var fld = fields[i];
     var fullRefName = paramName + "." + fld.Name;
     if (fromExpression.Contains(fullRefName))
       strValues.Add(fullRefName  + "=" + LoggingExtensions.ToLogString(fld.GetValue(obj)));
       }
       return string.Join(", ", strValues);
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:20,代码来源:CacheQueryLogEntry.cs

示例13: CloneTestSpecs

        private static void CloneTestSpecs(string rootBranch, string targetBranch, IDictionary<string, object> parameters)
        {
            if (parameters.ContainsKey(TestSpecs) && parameters[TestSpecs] != null)
            {
                var testSpecList = parameters[TestSpecs] as TestSpecList;
                if (testSpecList == null)
                {
                    return;
                }

                foreach (var spec in testSpecList)
                {
                    var assemblySpec = spec as TestAssemblySpec;
                    if (assemblySpec != null)
                    {
                        if (!string.IsNullOrEmpty(assemblySpec.TestSettingsFileName) && assemblySpec.TestSettingsFileName.StartsWith(rootBranch, StringComparison.OrdinalIgnoreCase))
                        {
                            assemblySpec.TestSettingsFileName = assemblySpec.TestSettingsFileName.Replace(rootBranch, targetBranch);
                        }
                    }

                    var metadataFileSpec = spec as TestMetadataFileSpec;
                    if (metadataFileSpec != null)
                    {
                        var modifiedTestLists = new StringList();
                        foreach (var list in metadataFileSpec.TestLists)
                        {
                            string modifiedTestList = list;
                            if (modifiedTestList.StartsWith(rootBranch, StringComparison.OrdinalIgnoreCase))
                            {
                                modifiedTestList = modifiedTestList.Replace(rootBranch, targetBranch);
                            }

                            modifiedTestLists.Add(modifiedTestList);
                        }

                        if (!string.IsNullOrEmpty(metadataFileSpec.MetadataFileName) && metadataFileSpec.MetadataFileName.StartsWith(rootBranch, StringComparison.OrdinalIgnoreCase))
                        {
                            metadataFileSpec.MetadataFileName = metadataFileSpec.MetadataFileName.Replace(rootBranch, targetBranch);
                        }
                    }
                }
            }
        }
开发者ID:caveman-dick,项目名称:BuildManager,代码行数:44,代码来源:TfsClientRepository.cs

示例14: UpdateStrains

 /// <summary>
 /// Updates Strains
 /// </summary>
 /// <param name="strains">StrainList Object</param>
 /// <returns></returns>
 public virtual StringList UpdateStrains(StrainList strains)
 {
     string source_id = GetSourceID();
     StrainMgr mgr = StrainMgr.Instance;
     if (strains == null)
     {
         StrainSearch search = StrainSearch.New();
         search.HasPhenotypeData = true;
         strains = mgr.GetStrains(search, SecurityContext.New());
     }
     StringList output = new StringList();
     foreach (Strain strain in strains)
     {
         string result;
         if (mgr.StrainHasPublications(strain.ID))
         {
             PublicationSearch pub_search = PublicationSearch.New();
             pub_search.StrainID = strain.ID;
             PublicationList pubs = PublicationMgr.Instance.GetPublications(pub_search, SecurityContext.New());
             foreach (Publication pub in pubs)
             {
                 string pubmedid = pub.ExternalReference.ExternalID;
                 result = UpdateResource(ObjectToResource(source_id, strain.HtmlName, strain.ID.ToString(), strain.StrainDescription, GetUrl("Strain") + strain.ID.ToString(), "mouse", "Mouse Strain", strain.History.CreationDate, GetGeneIDsFromStrain(strain.ID), null, pubmedid));
                 output.Add(result);
             }
         }
         else
         {
             result = UpdateResource(ObjectToResource(source_id, strain.HtmlName, strain.ID.ToString(), strain.StrainDescription, GetUrl("Strain") + strain.ID.ToString(), "mouse", "Mouse Strain", strain.History.CreationDate, GetGeneIDsFromStrain(strain.ID), null, null));
             output.Add(result);
         }
     }
     return output;
 }
开发者ID:dkcoin,项目名称:dkCOIN-1.2,代码行数:39,代码来源:DKCoinMgr.cs

示例15: GetResourceTypesAsStringList

        /// <summary>
        /// Get ResourceTypes
        /// </summary>
        /// <returns>StringList object</returns>
        public virtual StringList GetResourceTypesAsStringList()
        {
            try
            {
                if (webservice == null)
                    return new StringList();
                int typesCount = webservice.getResourceTypes().Length;
                dkCOIN.typeResourceType[] resourceTypes = new dkCOIN.typeResourceType[typesCount];
                resourceTypes = webservice.getResourceTypes();

                StringList resourceTypeList = new StringList();

                for (int i = 0; i < typesCount; i++)
                {
                    string resourceType = "";
                    resourceType = resourceTypes[i].name;

                    resourceTypeList.Add(resourceType);
                }

                return resourceTypeList;
            }
            catch (Exception e)
            {
                EmailErrorNotification(e.Message, "Attempting to execute StringList GetResourceTypes()");
                return null;
            }
        }
开发者ID:dkcoin,项目名称:dkCOIN-1.2,代码行数:32,代码来源:DKCoinMgr.cs


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