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


C# List.Exists方法代码示例

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


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

示例1: GetExtensionsInstalled

        public SettingPair[] GetExtensionsInstalled(ServerManager srvman)
        {
            var settings = new List<SettingPair>();
			var config = srvman.GetApplicationHostConfiguration();

            var handlersSection = (HandlersSection) config.GetSection(Constants.HandlersSection, typeof (HandlersSection));

            var executalbesToLookFor = new[]
            {
                // Perl
                new KeyValuePair<string, string>(Constants.PerlPathSetting, "\\perl.exe"),
                // Php
                new KeyValuePair<string, string>(Constants.Php4PathSetting, "\\php.exe"),
                new KeyValuePair<string, string>(Constants.PhpPathSetting, "\\php-cgi.exe"),
                // Classic ASP
                new KeyValuePair<string, string>(Constants.AspPathSetting, @"\inetsrv\asp.dll"),
                // ASP.NET
                new KeyValuePair<string, string>(Constants.AspNet11PathSetting, @"\Framework\v1.1.4322\aspnet_isapi.dll"),
                new KeyValuePair<string, string>(Constants.AspNet20PathSetting, @"\Framework\v2.0.50727\aspnet_isapi.dll"),
                new KeyValuePair<string, string>(Constants.AspNet40PathSetting, @"\Framework\v4.0.30319\aspnet_isapi.dll"),
                // ASP.NET x64
                new KeyValuePair<string, string>(Constants.AspNet20x64PathSetting, @"\Framework64\v2.0.50727\aspnet_isapi.dll"),
                new KeyValuePair<string, string>(Constants.AspNet40x64PathSetting, @"\Framework64\v4.0.30319\aspnet_isapi.dll"),
            };

            foreach (var handler in handlersSection.Handlers)
            {
                foreach (var valuePair in executalbesToLookFor)
                {
                    var key = valuePair.Key;
                    if (handler.ScriptProcessor.EndsWith(valuePair.Value) && !settings.Exists(s => s.Name == key))
                    {
						settings.Add(new SettingPair{Name = valuePair.Key, Value = handler.ScriptProcessor});
                    }
                }
            }

            return settings.ToArray();
        }
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:39,代码来源:ExtensionsModuleService.cs

示例2: IsRepetitiveCodeMasterRecord

 /// <summary>
 /// 是否重複的字碼主檔數據
 /// </summary>
 /// <param name="listAll">字碼主檔數據列表</param>
 /// <param name="recCheck">檢查數據</param>
 /// <returns></returns>
 private bool IsRepetitiveCodeMasterRecord(List<CodeMaster_cmt_Info> listAll, CodeMaster_cmt_Info recCheck)
 {
     if (listAll != null && recCheck != null)
     {
         bool res = listAll.Exists(x => x.cmt_cRemark == recCheck.cmt_cRemark);
         return res;
     }
     return true;
 }
开发者ID:Klutzdon,项目名称:PBIMSN,代码行数:15,代码来源:MachineRealtimeSummaryDAL.cs

示例3: IsRepetitiveAreaMasterRecord

 /// <summary>
 /// 是否重複的區域主檔數據
 /// </summary>
 /// <param name="listAll">區域主檔數據列表</param>
 /// <param name="recCheck">檢查數據</param>
 /// <returns></returns>
 private bool IsRepetitiveAreaMasterRecord(List<AreaMaster_amr_Info> listAll, AreaMaster_amr_Info recCheck)
 {
     if (listAll != null && recCheck != null)
     {
         bool res = listAll.Exists(x => x.amr_cAreaName == recCheck.amr_cAreaName);
         return res;
     }
     return true;
 }
开发者ID:Klutzdon,项目名称:PBIMSN,代码行数:15,代码来源:MachineRealtimeSummaryDAL.cs

示例4: ImportExcelData


//.........这里部分代码省略.........
                                if (listTmpUser != null && listTmpUser.Count > 0)
                                {
                                    //有对应用户时,对比是否拥有对应excel数据里的名字的用户
                                    CardUserMaster_cus_Info cusUser = listTmpUser.Find(x => x.cus_cChaName.Trim() == strTmpName.Trim() && x.cus_lValid);
                                    if (cusUser != null)
                                    {
                                        tmpRechargeInfo.UserID = cusUser.cus_cRecordID;

                                        if (cusUser.PairInfo != null)
                                        {
                                            tmpRechargeInfo.CardID = cusUser.PairInfo.ucp_cCardID;

                                            if (cusUser.ClassInfo != null)
                                            {
                                                tmpRechargeInfo.Dept = cusUser.ClassInfo.csm_cClassName;
                                            }
                                            else if (cusUser.DeptInfo != null)
                                            {
                                                tmpRechargeInfo.Dept = cusUser.DeptInfo.dpm_cName;
                                            }

                                            tmpRechargeInfo.Valid = true;
                                            tmpRechargeInfo.ValidInfo = "验证通过";
                                        }
                                        //else
                                        //{
                                        //    tmpRechargeInfo.ValidInfo = "用户卡信息异常";
                                        //    tmpRechargeInfo.Valid = false;
                                        //}
                                        tmpRechargeInfo.Valid = true;
                                        tmpRechargeInfo.ValidInfo = "验证通过";
                                    }
                                    else
                                    {
                                        tmpRechargeInfo.ValidInfo = "用户编号与用户名称不符合";
                                        tmpRechargeInfo.Valid = false;
                                    }
                                }
                                else
                                {
                                    tmpRechargeInfo.ValidInfo = "不存在该编号的用户";
                                    tmpRechargeInfo.Valid = false;
                                }
                            }
                            catch (Exception ex)
                            {
                                tmpRechargeInfo.ValidInfo = "第" + (i + 1).ToString() + "行数据异常,异常信息:" + ex.Message;
                                tmpRechargeInfo.Valid = false;
                            }

                            listTemp.Add(tmpRechargeInfo);

                            #endregion
                        }

                        if (listTemp.Count < 1)
                        {
                            ShowWarningMessage("没有可用的批量充值数据,请检查导入文件内容后重试。");
                            return;
                        }
                        if (listTemp.Count > Common.DefineConstantValue.MaxRechargeCount)
                        {
                            ShowWarningMessage("导入的充值记录数量超出限制【" + Common.DefineConstantValue.MaxRechargeCount.ToString() + "】条,请修改后重试。");
                            return;
                        }

                        lvBatchRechargeList.SetDataSource<TempBatchRechargeInfo>(listTemp, true);
                        if (lvBatchRechargeList.Items.Count > 0)
                        {
                            foreach (ListViewItem item in lvBatchRechargeList.Items)
                            {
                                if (Convert.ToBoolean(item.SubItems[2].Text))
                                {
                                    item.BackColor = Color.Green;
                                }
                                else
                                {
                                    item.BackColor = Color.Red;
                                }
                                item.ForeColor = Color.White;
                            }
                        }

                        bool isValid = listTemp.Exists(x => !x.Valid);
                        if (!isValid)
                        {
                            btnConfirmRecharge.Enabled = true;
                        }
                        else
                        {
                            btnConfirmRecharge.Enabled = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                base.ShowErrorMessage(ex);
            }
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:101,代码来源:frmTransferBatchRecharge.cs

示例5: findSP

        private void findSP(List<int> allResultIds, PartOfSpeech PartOfSpeech, ObjectType type, List<int> excludeIds)
        {
            // из всех текущих id выбираем такие, которые являются заданным типом СЧР
            List<int> idsToAnalyze = new List<int>();
            foreach (var resultId in allResultIds)
            {
                if (_sentence.WordList.Exists(x => x.Id == resultId && x.PartOfSpeech.Value == PartOfSpeech.Value))
                    idsToAnalyze.Add(resultId);
            }

            foreach (var wordId in idsToAnalyze)
            {
                //ищем дочернее слово для СЧР
                List<SentenceWord> childWords = _sentence.WordList.FindAll(x => x.DOM == wordId && !excludeIds.Contains(x.Id));

                foreach (var childWord in childWords)
                {
                    // найдем в текущих результатах такой элемент, id которого либо равен исследуемому, либо в его ServiceParts присутствует исследуемый id - чтобы знать куда добавлять инфу
                    var resultItem = Result.Items.Find(x => x.Id == wordId);
                    if (resultItem == null)
                    {
                        foreach (var i in Result.Items)
                        {
                            if (i.ServiceParts.Concat(i.AddedWordsCase1).Concat(i.AddedWordsCase2).ToList().Exists(x => x.Id == wordId))
                                resultItem = i;
                        }
                    }

                    if (resultItem != null)
                    {
                        // если дочернего слова нет в списке предварительных элеметнов, то добавляем его вместо текущего элемента, присоединяя к нему СЧР с заданным типом СЧР
                        if (!allResultIds.Exists(x => x == childWord.Id))
                        {
                            Stage3ResultElement itemToAdd = new Stage3ResultElement();
                            itemToAdd.IsRestoredFromServicePart = true;
                            itemToAdd.CopyFromSourceWord(childWord);
                            itemToAdd.ObjectType = type;
                            List<SentenceWord> itemAddWords = itemToAdd.ServiceParts.Concat(itemToAdd.AddedWordsCase1).Concat(itemToAdd.AddedWordsCase2).ToList();
                            if (itemAddWords.Find(x => x.Id == wordId) == null)
                                itemToAdd.AddedWordsCase2.Add(_sentence.WordList.Find(x => x.Id == wordId));

                            itemAddWords = itemToAdd.ServiceParts.Concat(itemToAdd.AddedWordsCase1).Concat(itemToAdd.AddedWordsCase2).ToList();
                            if (itemAddWords.Find(x => x.Id == wordId) == null)
                                itemToAdd.AddedWordsCase2.Add(_sentence.WordList.Find(x => x.Id == resultItem.Id));

                            Result.Items.Remove(resultItem);

                            Result.Items.Add(itemToAdd);
                        }
                        // а если такое слово есть, то берем его и объединяем с СЧР, с заданным типом
                        else
                        {
                            List<SentenceWord> resultAddWords = resultItem.ServiceParts.Concat(resultItem.AddedWordsCase1).Concat(resultItem.AddedWordsCase2).ToList();

                            if (resultAddWords.Find(x => x.Id == wordId) == null && resultItem.Id != wordId)
                                resultItem.AddedWordsCase2.Add(_sentence.WordList.Find(x => x.Id == wordId));
                            Result.Items.RemoveAll(x => x.Id == wordId);
                        }
                    }
                    else
                        Debug.WriteLine("IPPI MainParts 583: resultItem == null, sentence " + allResultIds.ToString());

                    allResultIds = getAllMainPartsIds(type);
                }
            }
        }
开发者ID:Ogonik,项目名称:LWS,代码行数:66,代码来源:LOMainPartsIPPIAlgorithms.cs

示例6: DecisionMakerType2

        public DecisionMakerType2(string stretchedParametersXml, FuzzyVariable outputVariable, RulesList ruleDefinitions, List<FuzzyVariable> includedVariables)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Type2ParamsList));
            XmlReaderSettings settings = new XmlReaderSettings();
            using (StringReader textReader = new StringReader(stretchedParametersXml))
            {
                using (XmlReader xmlReader = XmlReader.Create(textReader, settings))
                {
                    Type2ParamsList deserializedT2Params = (Type2ParamsList)serializer.Deserialize(xmlReader);

                    inputVariables = new List<Type2FuzzyVariable>();
                    foreach (var variable in deserializedT2Params.Items)
                    {
                        if (includedVariables.Exists(v => v.Name == variable.ParamName))
                        {
                            Type2FuzzyVariable newVariable = new Type2FuzzyVariable(
                                variable.ParamName,
                                variable.Min,
                                variable.Max,
                                variable.Unit);
                            foreach (var term in variable.Terms)
                            {
                                Type2FuzzyTerm newTerm = new Type2FuzzyTerm(
                                    term.name,
                                    new NormalMembershipFunction(term.b.Upper, term.c.Upper),
                                    new NormalMembershipFunction(term.b.Lower, term.c.Lower));
                                newVariable.Terms.Add(newTerm);
                            }

                            inputVariables.Add(newVariable);
                        }
                    }

                    // output variable
                    this.outputVariable = new Type2FuzzyVariable(
                            outputVariable.Name,
                            outputVariable.Min,
                            outputVariable.Max,
                            outputVariable.Unit);
                    foreach (var term in outputVariable.Terms)
                    {
                        Type2FuzzyTerm newTerm = new Type2FuzzyTerm(
                            term.Name,
                            new NormalMembershipFunction(
                                (term.MembershipFunction as NormalMembershipFunction).B,
                                (term.MembershipFunction as NormalMembershipFunction).Sigma),
                            new NormalMembershipFunction(
                                (term.MembershipFunction as NormalMembershipFunction).B,
                                (term.MembershipFunction as NormalMembershipFunction).Sigma));
                        this.outputVariable.Terms.Add(newTerm);
                    }

                    // rules
                    rules = new List<Type2MamdaniFuzzyRule>();
                    var updatedDefinitions = new List<RuleDef>();
                    foreach (var rule in ruleDefinitions.Items)
                    {
                        string[] splitDef = rule.Definition.Split(
                            new[] {"if", "and", "(", ")"},
                            StringSplitOptions.RemoveEmptyEntries);

                        string updatedDef = string.Empty;
                        foreach (var condition in splitDef)
                        {
                            if (condition == string.Empty)
                            {
                                continue;
                            }

                            var trimmedCondition = condition.Trim();
                            if (trimmedCondition.StartsWith("then"))
                            {
                                updatedDef += trimmedCondition;
                            }
                            else
                            {
                                string variable = trimmedCondition.Split(' ')[0];
                                if (includedVariables.Exists(v => v.Name == variable))
                                {
                                    string keyword = updatedDef == string.Empty ? "if" : "and";
                                    updatedDef += string.Format("{0} ({1}) ", keyword, trimmedCondition);
                                }
                            }
                        }

                        if (!updatedDefinitions.Exists(r => r.Definition.Equals(updatedDef)))
                        {
                            updatedDefinitions.Add(new RuleDef { Definition = updatedDef, Weight = rule.Weight });
                            Type2MamdaniFuzzyRule newRule = ParseRule(updatedDef);
                            newRule.Weight = rule.Weight;
                            rules.Add(newRule);
                        }
                    }

                    isInitialized = true;
                }
            }
        }
开发者ID:osnihur,项目名称:fuzzycheck,代码行数:98,代码来源:DecisionMakerType2.cs


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