本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.Count方法的具体用法?C# System.Collections.Generic.List.Count怎么用?C# System.Collections.Generic.List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.Count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: longTouFengWei
//.........这里部分代码省略.........
nums++;
result.AddRange(touZh());
}
}
foreach (Control ctls in this.weiDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDx());
}
}
foreach (Control ctls in this.weiDsGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDs());
}
}
foreach (Control ctls in this.weiZhGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiZh());
}
}
}
if (mm.Contains("杀去"))
{
foreach (Control ctls in this.touDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touDx());
}
}
foreach (Control ctls in this.touDsGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touDs());
}
}
foreach (Control ctls in this.touZhGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touZh());
}
}
foreach (Control ctls in this.weiDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDx());
}
}
foreach (Control ctls in this.weiDsGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDs());
}
}
foreach (Control ctls in this.weiZhGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiZh());
}
}
List<string> temp = new List<string>();
temp.AddRange(chaHe());
for (int i = 0; i < result.Count(); i++)
{
temp.Remove(result[i]);
}
result.Clear();
result.AddRange(temp);
}
if (nums == 0)
{
result.AddRange(chaHe());
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例2: pingHengZhiShu
//平衡指数
public string[] pingHengZhiShu()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = fanBianQiuCal();
int overMy = 0;
List<int> nums = new List<int>();
foreach (Control ctls in this.pHZSGpb.Controls)
{
bool isNum = isNumber(ctls.Text);
if (ctls is CheckBox)
{
if ((ctls as CheckBox).Checked == true && isNum == true)
{
nums.Add(Convert.ToInt16(ctls.Text));
}
}
}
if (nums.Count == 1)
{
if (nums.Contains(1))
{
if (jiaCkb.Checked == true)
{
overMy++;
result.AddRange(phJia());
}
if (jianCkb.Checked == true)
{
overMy++;
result.AddRange(phJian());
}
if (dengCkb.Checked == true)
{
overMy++;
result.AddRange(phDeng());
}
}
if (nums.Contains(0))
{
if (jiaCkb.Checked == true)
{
overMy++;
result.AddRange(phJia());
}
if (jianCkb.Checked == true)
{
overMy++;
result.AddRange(phJian());
}
if (dengCkb.Checked == true)
{
overMy++;
result.AddRange(phDeng());
}
List<string> temp = new List<string>();
temp.AddRange(chaHe());
for (int i = 0; i < result.Count(); i++)
{
temp.Remove(result[i]);
}
result.Clear();
result.AddRange(temp);
}
}
if (nums.Count == 2)
{
result.AddRange(allNum);
}
if (overMy == 0)
result.AddRange(allNum);
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
return result1.ToArray();
}
示例3: Display_AliasTab
private void Display_AliasTab()
{
StringBuilder sbHtml = new StringBuilder();
Ektron.Cms.UrlAliasing.UrlAliasManualApi _manualAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
Ektron.Cms.UrlAliasing.UrlAliasAutoApi _autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
System.Collections.Generic.List<string> aliasExtensions;
string ext = "";
int i;
Ektron.Cms.Common.UrlAliasManualData defaultManualAlias = new Ektron.Cms.Common.UrlAliasManualData(0, 0, string.Empty, string.Empty);
System.Collections.Generic.List<UrlAliasAutoData> autoAliasList = new System.Collections.Generic.List<UrlAliasAutoData>();
aliasExtensions = _manualAliasApi.GetFileExtensions();
if (entry_edit_data != null)
{
defaultManualAlias = _manualAliasApi.GetDefaultAlias(entry_edit_data.Id);
}
sbHtml.Append("<div>");
if (_urlAliasSettingApi.IsManualAliasEnabled)
{
if (m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias))
{
sbHtml.Append("<fieldset><legend><strong>" + m_refMsg.GetMessage("lbl tree url manual aliasing") + "</strong></legend>");
sbHtml.Append("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">");
sbHtml.Append("<tr><td colspan=4> <br></td></tr>");
sbHtml.Append("<tr><td> </td><td class=\"info\" nowrap=\"true\">" + m_refMsg.GetMessage("lbl primary") + " " + m_refMsg.GetMessage("lbl alias name") + ": ");
sbHtml.Append("<td> <input type=\"hidden\" name=\"frm_manalias_id\" value=\"" + defaultManualAlias.AliasId + "\"></td>");
sbHtml.Append("<td> <input type=\"hidden\" name=\"prev_frm_manalias_name\" value=\"" + defaultManualAlias.AliasName + "\"></td>");
sbHtml.Append("<td> <input type=\"hidden\" name=\"prev_frm_manalias_ext\" value=\"" + defaultManualAlias.FileExtension + "\"></td>");
if (catalog_data.IsDomainFolder)
{
sbHtml.Append("<td width=\"95%\">http://" + catalog_data.DomainProduction + "/<input type=\"text\" size=\"35\" id=\"frm_manalias\" name=\"frm_manalias\" value=\"" + defaultManualAlias.AliasName + "\">");
}
else
{
sbHtml.Append("<td width=\"95%\">" + m_refContentApi.SitePath + "<input type=\"text\" size=\"35\" id=\"frm_manalias\" name=\"frm_manalias\" value=\"" + defaultManualAlias.AliasName + "\">");
}
for (i = 0; i <= aliasExtensions.Count - 1; i++)
{
if (ext != "")
{
ext = ext + ",";
}
ext = ext + aliasExtensions[i];
}
sbHtml.Append(m_refContentApi.RenderHTML_RedirExtensionDD("frm_ManAliasExt", defaultManualAlias.FileExtension, ext));
sbHtml.Append("<br/></td>");
sbHtml.Append("</tr></table></fieldset>");
sbHtml.Append("<br/><br/><br/>");
}
else
{
sbHtml.Append("<input type=\"hidden\" name=\"frm_manalias_id\" value=\"" + defaultManualAlias.AliasId + "\">");
sbHtml.Append("<input type=\"hidden\" name=\"frm_manalias\" value=\"" + defaultManualAlias.AliasName + defaultManualAlias.FileExtension + "\">");
}
}
if (_urlAliasSettingApi.IsAutoAliasEnabled)
{
if (entry_edit_data != null)
{
autoAliasList = _autoaliasApi.GetListForContent(entry_edit_data.Id);
}
sbHtml.Append("<div class=\"autoAlias\" style=\"width: auto; height: auto; overflow: auto;\" id=\"autoAliasList\">");
sbHtml.Append("<fieldset><legend><strong>" + m_refMsg.GetMessage("lbl automatic") + "</strong></legend><br/>");
sbHtml.Append("<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">");
sbHtml.Append("<tr><td><u><strong>" + m_refMsg.GetMessage("generic type") + "</strong></u></td>");
sbHtml.Append("<td><u><strong>" + m_refMsg.GetMessage("lbl alias name") + "</strong></u></td></tr>");
for (i = 0; i <= autoAliasList.Count() - 1; i++)
{
sbHtml.Append("<tr><td>" + autoAliasList[i].AutoAliasType.ToString() + "</td>");
sbHtml.Append("<td>" + autoAliasList[i].AliasName + "</td></tr>");
}
sbHtml.Append("</table></fieldset></div>");
}
sbHtml.Append("</div>");
ltrEditAlias.Text = sbHtml.ToString();
}
示例4: GetClientScript
//.........这里部分代码省略.........
SiteAPI m_refSiteApi = new SiteAPI();
SettingsData settings_data;
settings_data = m_refSiteApi.GetSiteVariables(m_refSiteApi.UserId);
if (!(settings_data == null))
{
if (settings_data.IsAdInstalled)
{
result.Append("level2 = InsertFolder(level1, CreateFolderInstance(\"" + objMessage.GetMessage("generic Active Directory") + "\", \"\"));");
if (m_refSiteApi.RequestInformationRef.ADAdvancedConfig == true)
{
result.Append("var urlInfoArray = new Array(\"frame\", \"AD/ADDomains.aspx\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("generic ad domains") + "\", urlInfoArray));");
}
result.Append("var urlInfoArray = new Array(\"frame\", \"adconfigure.aspx\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("generic Setup") + "\", urlInfoArray));");
result.Append("var urlInfoArray = new Array(\"frame\", \"adreports.aspx?action=ViewAllReportTypes\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("generic Status") + "\", urlInfoArray));");
}
}
if (!IsSystemAccount)
{
if (System.Configuration.ConfigurationSettings.AppSettings["ek_Dictionary"] != null && Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["ek_Dictionary"]))
{
// Dictionary
result.Append("level2 = InsertFolder(level1, CreateFolderInstance(\"Dictionary\", \"\"));");
result.Append("var urlInfoArray = new Array(\"frame\", \"dictionary/addnew.aspx\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"Add new dictionary\", urlInfoArray));");
ICmsDictionary dictionaryManager = ObjectFactory.GetCmsDictionary();
Criteria<CmsDictionaryProperty> dictionaryCriteria = new Criteria<CmsDictionaryProperty>();
dictionaryCriteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending;
dictionaryCriteria.OrderByField = CmsDictionaryProperty.Name;
List<CmsDictionaryData> dictionaryList = dictionaryManager.GetList(dictionaryCriteria);
for (int i = 0; i < dictionaryList.Count; i++)
{
result.Append("var urlInfoArray = new Array(\"frame\", \"dictionary/editvalues.aspx?id=" + dictionaryList[i].Id + "\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + dictionaryList[i].Name + "\", urlInfoArray));");
}
// Dictionary
}
result.Append("level2 = InsertFolder(level1, CreateFolderInstance(\"" + objMessage.GetMessage("lbl web alert properties") + "\", \"\"));");
// email from list
result.Append("var urlInfoArray = new Array(\"frame\", \"subscriptionemailfromlist.aspx\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl subscription emailfrom properties") + "\", urlInfoArray));");
// messages
result.Append("var urlInfoArray = new Array(\"frame\", \"subscriptionmessages.aspx\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl subscription message properties") + "\", urlInfoArray));");
// subscriptions
result.Append("var urlInfoArray = new Array(\"frame\", \"subscriptions.aspx?action=ViewAllSubscriptions\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl subscription properties") + "\", urlInfoArray));");
//search properties
result.Append("level2 = InsertFolder(level1, CreateFolderInstance(\"" + objMessage.GetMessage("generic search") + "\", \"\"));");
result.Append("var urlInfoArray = new Array(\"frame\", \"search/suggestedresults.aspx?action=ViewSuggestedResults\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl suggested results") + "\", urlInfoArray));");
result.Append("var urlInfoArray = new Array(\"frame\", \"search/status.aspx?action=ViewSearchStatus\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl search status") + "\", urlInfoArray));");
result.Append("var urlInfoArray = new Array(\"frame\", \"search/synonyms.aspx?action=ViewSynonyms\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl synonyms") + "\", urlInfoArray));");
result.Append("var urlInfoArray = new Array(\"frame\", \"search/mappings.aspx\", \"ek_main\");");
result.Append("InsertFile(level2, CreateLink(\"" + objMessage.GetMessage("lbl integrated search mappings") + "\", urlInfoArray));");
//forum properties
result.Append("level2 = InsertFolder(level1, CreateFolderInstance(\"" + objMessage.GetMessage("lbl disc boards") + "\", \"\"));");
result.Append("var urlInfoArray = new Array(\"frame\", \"threadeddisc/replacewords.aspx?isemoticon=1\", \"ek_main\");");
示例5: valid
public bool valid(System.Collections.Generic.List<string[]> fieldsValues)
{
bool odp = true;
string left = this.paternLeft;
string right = this.paternRight;
left = left.Replace(" and ", " AND ");
right = right.Replace(" and ", " AND ");
bool result;
if (this.variable.Count == 0)
{
for (int i = 0; i < fieldsValues.Count; i++)
{
left = left.Replace(fieldsValues[i][0], fieldsValues[i][1]);
right = right.Replace(fieldsValues[i][0], fieldsValues[i][1]);
}
result = this.check(left, right);
}
else
{
if (this.variable.Count == 1)
{
System.Collections.Generic.List<string> valueVariable = new System.Collections.Generic.List<string>();
for (int i = 0; i < fieldsValues.Count; i++)
{
if (this.fields[i].Length > 2)
{
valueVariable.Add(fieldsValues[i][1]);
}
else
{
left = left.Replace(fieldsValues[i][0], fieldsValues[i][1]);
right = right.Replace(fieldsValues[i][0], fieldsValues[i][1]);
}
}
string lefttmp = left;
string righttmp = right;
if (System.Text.RegularExpressions.Regex.IsMatch(lefttmp, "sum") || System.Text.RegularExpressions.Regex.IsMatch(righttmp, "sum"))
{
System.Text.RegularExpressions.Match L = System.Text.RegularExpressions.Regex.Match(lefttmp, "sum\\(.+\\)");
System.Text.RegularExpressions.Match R = System.Text.RegularExpressions.Regex.Match(righttmp, "sum\\(.+\\)");
if (R.Success)
{
string sumExp = R.Value.Replace("(", "").Replace(")", "").Replace("sum", "");
if (sumExp == this.variable[0])
{
int sum = 0;
for (int j = 0; j < valueVariable.Count; j++)
{
try
{
sum += System.Convert.ToInt32(valueVariable[j]);
}
catch (System.FormatException)
{
}
catch (System.OverflowException)
{
}
}
righttmp = righttmp.Replace(R.Value, sum.ToString());
}
}
if (L.Success)
{
string sumExp = L.Value.Replace("(", "").Replace(")", "").Replace("sum", "");
if (sumExp == this.variable[0])
{
int sum = 0;
for (int j = 0; j < valueVariable.Count; j++)
{
try
{
sum += System.Convert.ToInt32(valueVariable[j]);
}
catch (System.FormatException)
{
}
catch (System.OverflowException)
{
}
}
lefttmp = lefttmp.Replace(L.Value, sum.ToString());
}
}
result = this.check(lefttmp, righttmp);
return result;
}
for (int j = 0; j < valueVariable.Count; j++)
{
lefttmp = left;
righttmp = right;
lefttmp = lefttmp.Replace(this.variable[0], valueVariable[j]);
righttmp = righttmp.Replace(this.variable[0], valueVariable[j]);
if (!this.check(lefttmp, righttmp))
{
result = false;
return result;
}
}
}
//.........这里部分代码省略.........
示例6: printErrors
//.........这里部分代码省略.........
catch (System.Exception)
{
}
try
{
if (tooltipText3 != "")
{
try
{
if (this.SummationPanel.Controls[contolErrors.Key].Enabled)
{
this.tooltipErrors.SetToolTip(this.SummationPanel.Controls[contolErrors.Key], tooltipText3);
}
}
catch (System.Exception)
{
try
{
if (this.raportPanel.Controls[contolErrors.Key].Enabled)
{
this.tooltipErrors.SetToolTip(this.raportPanel.Controls[contolErrors.Key], tooltipText3);
}
}
catch (System.Exception)
{
}
}
}
}
catch (System.Exception)
{
}
}
if (headerErrors.Count > 1)
{
for (int j = 0; j < headerErrors.Count<Label>(); j++)
{
if (j == 0)
{
headerErrors[j].Location = new System.Drawing.Point(x, y);
this.errorPanel.Controls.Add(headerErrors[j]);
y += headerErrors[j].Height + 20;
}
else
{
headerErrors[j].Location = new System.Drawing.Point(x, y);
this.errorPanel.Controls.Add(headerErrors[j]);
y += headerErrors[j].Height + 5;
}
}
y += 20;
}
if (step1and2Errors.Count > 1)
{
for (int j = 0; j < step1and2Errors.Count<Label>(); j++)
{
if (j == 0)
{
step1and2Errors[j].Location = new System.Drawing.Point(x, y);
this.errorPanel.Controls.Add(step1and2Errors[j]);
y += step1and2Errors[j].Height + 20;
}
else
{
step1and2Errors[j].Location = new System.Drawing.Point(x, y);
this.errorPanel.Controls.Add(step1and2Errors[j]);
示例7: EditAliasHtmlScripts
private void EditAliasHtmlScripts()
{
StringBuilder sbHtml = new StringBuilder();
Ektron.Cms.UrlAliasing.UrlAliasManualApi m_aliaslist = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
Ektron.Cms.UrlAliasing.UrlAliasAutoApi m_autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
System.Collections.Generic.List<string> ext_alias;
string ext = "";
int i;
Ektron.Cms.Common.UrlAliasManualData d_alias = new Ektron.Cms.Common.UrlAliasManualData(0, 0, string.Empty, string.Empty);
System.Collections.Generic.List<UrlAliasAutoData> auto_aliaslist = new System.Collections.Generic.List<UrlAliasAutoData>();
bool IsStagingServer;
IsStagingServer = m_refContApi.RequestInformationRef.IsStaging;
ext_alias = m_aliaslist.GetFileExtensions();
if (content_edit_data != null)
{
d_alias = m_aliaslist.GetDefaultAlias(content_edit_data.Id);
}
m_strManualAliasExt = d_alias.AliasName;
m_strManualAlias = d_alias.FileExtension;
sbHtml.Append("<div id=\"dvAlias\">");
if (m_urlAliasSettings.IsManualAliasEnabled)
{
if (m_refContApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias))
{
sbHtml.Append("<input type=\"hidden\" name=\"frm_manalias_id\" value=\"" + d_alias.AliasId + "\">");
sbHtml.Append("<input type=\"hidden\" id=\"prev_frm_manalias_name\" name=\"prev_frm_manalias_name\" value=\"" + d_alias.AliasName + "\">");
sbHtml.Append("<input type=\"hidden\" name=\"prev_frm_manalias_ext\" value=\"" + d_alias.FileExtension + "\">");
sbHtml.Append("<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl tree url manual aliasing") + "</div>");
sbHtml.Append("<table class=\"ektronForm\">");
sbHtml.Append("<tr>");
sbHtml.Append("<td class=\"label\">");
sbHtml.Append(m_refMsg.GetMessage("lbl primary") + " " + m_refMsg.GetMessage("lbl alias name") + ":");
sbHtml.Append("</td>");
sbHtml.Append("<td class=\"value\">");
if (IsStagingServer && folder_data.DomainStaging != string.Empty)
{
sbHtml.Append("<td width=\"95%\">http://" + folder_data.DomainStaging + "/<input type=\"text\" id=\"frm_manalias\" size=\"35\" name=\"frm_manalias\" value=\"" + d_alias.AliasName + "\">");
}
else if (folder_data.IsDomainFolder)
{
sbHtml.Append("http://" + folder_data.DomainProduction + "/<input type=\"text\" id=\"frm_manalias\" size=\"35\" name=\"frm_manalias\" value=\"" + d_alias.AliasName + "\">");
}
else
{
sbHtml.Append(SitePath + "<input type=\"text\" id=\"frm_manalias\" size=\"35\" name=\"frm_manalias\" value=\"" + d_alias.AliasName + "\">");
}
for (i = 0; i <= ext_alias.Count - 1; i++)
{
if (ext != "")
{
ext = ext + ",";
}
ext = ext + ext_alias[i];
}
sbHtml.Append(m_refContApi.RenderHTML_RedirExtensionDD("frm_ManAliasExt", d_alias.FileExtension, ext));
sbHtml.Append("</td>");
sbHtml.Append("</tr>");
sbHtml.Append("</table>");
if (m_refContApi.RedirectorManExt.IndexOf(",") + 1 <= 0)
{
ast_frm_manaliasExt.Value = m_refContApi.RedirectorManExt;
}
}
}
if (m_urlAliasSettings.IsAutoAliasEnabled)
{
if (content_edit_data != null)
{
auto_aliaslist = m_autoaliasApi.GetListForContent(content_edit_data.Id);
}
sbHtml.Append("<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl automatic") + "</div>");
sbHtml.Append("<div class=\"ektronBorder\" style=\"width: auto; height: auto; overflow: auto;\" id=\"autoAliasList\">");
sbHtml.Append("<table width=\"100%\">");
sbHtml.Append("<tr class=\"title-header\">");
sbHtml.Append("<th>");
sbHtml.Append(m_refMsg.GetMessage("generic type"));
sbHtml.Append("</th>");
sbHtml.Append("<th>");
sbHtml.Append(m_refMsg.GetMessage("lbl alias name"));
sbHtml.Append("</th>");
for (i = 0; i <= auto_aliaslist.Count() - 1; i++)
{
sbHtml.Append("<tr>");
sbHtml.Append("<td>" + auto_aliaslist[i].AutoAliasType.ToString() + "</td>");
sbHtml.Append("<td>" + auto_aliaslist[i].AliasName + "</td>");
sbHtml.Append("</tr>");
}
sbHtml.Append("</table>");
sbHtml.Append("</div>");
}
sbHtml.Append("</div>");
EditAliasHtml.Text = sbHtml.ToString();
}