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


C# List.Remove方法代码示例

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


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

示例1: GridView1_RowCommand

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List<Matricula> lstMatri = new List<Matricula>();

            if (Session["Matri"] != null)
            {
                lstMatri = ((List<Matricula>)Session["Matri"]);
            }
            
            string codigo=GridMatricula.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();


            Matricula MatriculaEncontrada = lstMatri.SingleOrDefault(s => s.Codigo == Convert.ToInt32(codigo));

            if (e.CommandName == "Editar")
            {
                txtCodigo.Text = MatriculaEncontrada.Codigo.ToString();
                txtNombre.Text = MatriculaEncontrada.NombreEstud;
                txtValor.Text = MatriculaEncontrada.Valor.ToString();
            }

            if (e.CommandName == "Eliminar")
            {
                lstMatri.Remove(MatriculaEncontrada);

                //int indice =   lstFactu.IndexOf(factuEncontrada);
                //lstFactu.RemoveAt(indice);                
            }

            GridMatricula.DataSource = lstMatri;
            GridMatricula.DataKeyNames = new string[] { "Codigo" };
            GridMatricula.DataBind();
        }
开发者ID:harry9524,项目名称:ASP.Net-Proyectos,代码行数:33,代码来源:Formulario.aspx.cs

示例2: PrepareUserKeywords

            public static string[] PrepareUserKeywords(string SampleKeywordsText)
            {
                List<string> Keywords = new List<string>();
                try
                {
                    int i=0;
                    string[] splitter = { ".", " ", ":", ",", ";", "'", "\"", "(", ")" };
                    string[] UserWords = SampleKeywordsText.Split(splitter, StringSplitOptions.RemoveEmptyEntries);


                    SetWords();

                    foreach (string uWord in UserWords)
                    {

                        foreach (string word in words)
                        {

                        if (word.Contains("-") && i<UserWords.Length-1 )
                        {
                            int k=i+1;
                            if (word.ToLower() == uWord.ToLower()+"-"+UserWords[k].ToLower())
                            {

                                Keywords.Add(word);
                                break;
                            }
                        }
                        else
                        {
                            if (word.ToLower() == uWord.ToLower())
                            {

                                Keywords.Add(word);
                                break;
                            }

                        }

                        }

                        i++;
                    }
                }
                catch (Exception es)
                { }

                List<string> newWords = new List<string>();


                foreach (string temp in Keywords)
                {

                    if (newWords.Contains(temp))
                    {

                    }
                    else
                    {

                        newWords.Add(temp);
                    
                    }
                
                }


                words = new List<string>();
                StreamReader read = new StreamReader(HttpContext.Current.Server.MapPath("~/App_Data/Words.txt"));

                string lineRead = read.ReadLine();

                while (lineRead != null)
                {

                    words.Add(lineRead);
                    try
                    {
                        lineRead = read.ReadLine();
                    }
                    catch (NullReferenceException ec)
                    {
                        break;
                    }
                }
                read.Close();
                read.Dispose();


                foreach (string word in words)
                {

                    if (newWords.Contains(word))
                    {

                        newWords.Remove(word);
                    }
                
                }

//.........这里部分代码省略.........
开发者ID:talhahasanzia,项目名称:Journal_Classifier,代码行数:101,代码来源:Comparator.cs

示例3: QtrClassSearch

        //searches for classes that are available this quarter that student meets requirements for
        protected List<string> QtrClassSearch()
        {
            List<string> currentClasses = new List<string>();
            List<string> needed = new List<string>();
            List<int> reqList = new List<int>();
            int count;

            if (date[1] == 3 || date[1] == 4) count = SummerN;
            else count = QtrN;

            //if you still need intro courses, you can't take any else
            if (introNeeded)
            {
                reqList = new List<int>(introReqID);
                reqList.Sort();
                foreach (int ReqID in reqList)
                {
                    //gets classes offered that have met prereqs
                    needed = ClassesOffered(ReqID);
                    while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
                    {
                        string course = needed[0];
                        needed.Remove(course);
                        ReqIDClassesNeeded[ReqID].Remove(course);

                        if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
                        {
                            ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
                            count = count - 1;
                            currentClasses.Add(course);
                        }
                    }
                }
                if (checkIntro()) introNeeded = false;
            }
            //searches for main courses
            else
            {
                reqList = new List<int>(mainReqID);
                reqList.Sort();
                foreach (int ReqID in reqList)
                {
                    //gets classes offered that have met prereqs
                    needed = ClassesOffered(ReqID);
                    while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
                    {
                        string course = needed[0];
                        needed.Remove(course);
                        ReqIDClassesNeeded[ReqID].Remove(course);

                        //if(course == "GAM 690") resultsBox.Items.Add(new ListItem("Looking at " + course + "in qtrSearch", course));

                        if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
                        {
                            ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
                            count = count - 1;
                            currentClasses.Add(course);
                        }
                    }
                }
            }
            //adds classes to studenthistory
            foreach (string cl in currentClasses) { studentHistory.Add(cl); }
            return currentClasses;
        }
开发者ID:timerwoolf,项目名称:WhenIfApp,代码行数:66,代码来源:Calculator.aspx.cs


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