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


C# LinkedList.ElementAt方法代码示例

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


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

示例1: convertToDFA

        static LinkedList<LinkedList<string>> convertToDFA(LinkedList<LinkedList<string>> NFA_Table, LinkedList<string> states, LinkedList<string> finalStates, LinkedList<string> alphabets)
        {
            LinkedList<LinkedList<string>> DFA_Table = new LinkedList<LinkedList<string>>();
            LinkedList<string> DFA_States = new LinkedList<string>();
            string newState="";
            DFA_States.AddLast("0");
            for (int i = 0; i < DFA_States.Count; i++)
            {
                for (int j = 0; j < alphabets.Count; j++)
                {
                    for (int k = 0; k < NFA_Table.Count; k++)
                    {
                        if (NFA_Table.ElementAt(k).ElementAt(0).CompareTo(DFA_States.ElementAt(i)) == 0 && NFA_Table.ElementAt(k).ElementAt(2).CompareTo(alphabets.ElementAt(j)) == 0)
                        {
                            newState += NFA_Table.ElementAt(i).ElementAt(1);
                        }
                    }
                    if (DFA_States.Contains(newState) == false)
                    {
                        DFA_States.AddLast(newState);
                        LinkedList<string> DFA_Contacts = new LinkedList<string>();
                        DFA_Contacts.AddLast(DFA_States.ElementAt(i));
                        DFA_Contacts.AddLast(newState);
                        DFA_Contacts.AddLast(alphabets.ElementAt(j));
                        DFA_Table.AddLast(DFA_Contacts);

                    }
                    newState = "";
                }
            }

            return DFA_Table;
        }
开发者ID:amin-rahimi,项目名称:nfa2dfa,代码行数:33,代码来源:Program.cs

示例2: Page_Load

       //private static LinkedList<Operador> operadores = new LinkedList<Operador>(); 

        protected void Page_Load(object sender, EventArgs e)
        {
            User user = Session["UserObj"] == null ? new User() : (User)Session["UserObj"];;

            if (!user.Rol.VerConsRespuestaOpe)
            {
                Response.Redirect("~/Default.aspx");
            }

            var title = (HtmlGenericControl)Master.FindControl("pageTitleSpan");

            title.InnerText = Title;            

            //if (!IsPostBack)
            //{    
                if ((user.Rol.ID) != (int)Role.TipoRoles.Excavador)
                {
                    //e.Command.CommandText = e.Command.CommandText.Replace("@Where", string.Empty);

                    LinkedList<Operador> operadores = new SolicitudesInicialesServicio().GetOperadores();

                    Session.Remove("operadores");

                    Session["operadores"] = operadores;

                    if (!IsPostBack)
                    {
                        ddlOperador.Items.Add("Seleccionar Sin Filtro");

                        foreach (var o in operadores)
                        {
                            ddlOperador.Items.Add(o.Nombre);
                        }
                    }

                    SetRespuestasRowData(new RespuestasServicio().GetRespuestas(), operadores);
                }

                else
                {
                    LinkedList<Operador> operadores = new LinkedList<Operador>();

                    operadores.AddLast(new SolicitudesInicialesServicio().GetOperadorByName(user.EmpresaID));

                    ddlOperador.Items.Add(operadores.ElementAt(0).Nombre);

                    ddlOperador.Enabled = false;

                    SetRespuestasRowData(new RespuestasServicio().GetRespuestas(operadores.ElementAt(0)), operadores);

                    //e.Command.CommandText = e.Command.CommandText.Replace("@Where", string.Format("WHERE CorreoElectronico = '{0}' ", Global.user.Email));
                }

                
            //}
        }
开发者ID:ijustarrived,项目名称:EXC,代码行数:58,代码来源:RespuestasPorOperador.aspx.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            _catsList = _userCatBL.GetAllCats();

            var dt = new DataTable();
            var dcBreed = new DataColumn("Breed", typeof(string));
            var dcCountry = new DataColumn("Country", typeof(string));
            var dcOrigin = new DataColumn("Origin", typeof(string));
            var dcBodyType = new DataColumn("Body Type", typeof(string));
            var dcCoat = new DataColumn("Coat", typeof(string));
            var dcPattern = new DataColumn("Pattern", typeof(string));
            var dcImage = new DataColumn("Image", typeof(string));

            dt.Columns.AddRange(new[] { dcBreed, dcCountry, dcOrigin, dcBodyType, dcCoat, dcPattern, dcImage });

            ChooseBreedDropDownList.Items.Add("Choose Breed");

            for (var i = 0; i < _catsList.Count; i++)
            {
                ChooseBreedDropDownList.Items.Add(_catsList.ElementAt(i).GetBreed().Trim());

                dt.Rows.Add(new object[]
                    {
                        _catsList.ElementAt(i).GetBreed().Trim(), _catsList.ElementAt(i).GetCountry().Trim(),
                        _catsList.ElementAt(i).GetOrigin().Trim(), _catsList.ElementAt(i).GetBodyType().Trim(),
                        _catsList.ElementAt(i).GetCoat().Trim(), _catsList.ElementAt(i).GetPattern().Trim(),
                        ResolveUrl(_catsList.ElementAt(i).GetImage().Trim())
                    });
            }

            AllBreedGrid.DataSource = dt;
            AllBreedGrid.DataBind();
        }
开发者ID:vnovikov746,项目名称:Crazy-Cat-Lady,代码行数:33,代码来源:DeleteCat.aspx.cs

示例4: AddShipRandomly

        public void AddShipRandomly(int length, Random positionGenerator)
        {
            if (length < 1 || length > boardPositions.GetLength(0))
                throw new Exception("Ship size can not be smaller than 1 or greater than board size.");

            LinkedList<int[]> PossiblePositions = new LinkedList<int[]>();
            //First two positions in each int[] in PossibleArrays contains indexes for possible position, final position in each int[] describes orientation (0 is along first axis, 1 is along second)
            for (int i = 0; i < boardPositions.GetLength(0); i++)
                for (int j = 0; j < boardPositions.GetLength(1); j++)
                    if (CheckShipPositionAvailable(length, i, j, true))
                        PossiblePositions.AddLast(new int[3] { i, j, 0 });

            for (int i = 0; i < boardPositions.GetLength(0); i++)
                for (int j = 0; j < boardPositions.GetLength(1); j++)
                    if (CheckShipPositionAvailable(length, i, j, false))
                        PossiblePositions.AddLast(new int[3] { i, j, 1 });
            if (PossiblePositions.Count == 0)
                throw new NoRoomForShipException(length);
            remainingPegs = remainingPegs + length;

            int[] FinalPosition = PossiblePositions.ElementAt(positionGenerator.Next(0, PossiblePositions.Count));

            if (FinalPosition[2] == 0)
                for (int i = 0; i < length; i++)
                    boardPositions[FinalPosition[0] + i, FinalPosition[1]] = true;
            if (FinalPosition[2] == 1)
                for (int i = 0; i < length; i++)
                    boardPositions[FinalPosition[0], FinalPosition[1] + i] = true;
        }
开发者ID:JohnSass,项目名称:Awalab_BuggyBattleships,代码行数:29,代码来源:Program.cs

示例5: ComposeEmail

        public MailMessage ComposeEmail(LinkedList<string> to, string from, string subj, string body, LinkedList<string> attaches)
        {
            MailMessage msg = new MailMessage();

            for (int i = 0; i < to.Count; i++)
            {
                msg.To.Add(to.ElementAt(i));
            }

            msg.From = new MailAddress(from);

            msg.Subject = subj;

            msg.Body = string.Format(@"{0}

Aviso legal: Este correo electrónico, y cualquier documento adjunto, contiene información propietaria,
 confidencial y/o privilegiada, perteneciente al Departamento de Transportación y 
 Obras Publicas de Puerto Rico (DTOP) y destinados exclusivamente al uso de la persona o entidad a la 
 que van dirigidos. Si usted no es el destinatario, se le notifica que cualquier divulgación, copia o 
 distribución de este mensaje, o la toma de cualquier acción basada en ella, está estrictamente 
 prohibido. Si ha recibido este mensaje por error, por favor notifique inmediatamente al responder al
 mensaje, y luego eliminarlo de su sistema.", body);

            foreach (var a in attaches)
            {
                if (!string.IsNullOrWhiteSpace(a))
                {
                    msg.Attachments.Add(new Attachment(a));
                }                
            }

            return msg;
        }
开发者ID:ijustarrived,项目名称:EXC,代码行数:33,代码来源:Email.cs

示例6: PileShuffle

        /// <summary>
        /// Breaks deck into as many as 7 piles and places the cards one by one into piles
        /// </summary>
        /// <param name="deck"></param>
        /// <returns></returns>
        public CardCollectionOperationResult PileShuffle(Deck deck)
        {
            int pileCount = Math.Min(DEFAULT_PILE_COUNT, deck.Count);
            int cardCount = deck.Count;
            LinkedList<Deck> piles = new LinkedList<Deck>(new Deck[pileCount]);

            for (int i = 0; i < cardCount; ++i)
            {
                Card card = deck.ElementAt(0);
                Deck currentPile = piles.ElementAt(0);

                deck.RemoveAt(0);

                currentPile.Insert(0, card);

                piles.AddLast(currentPile);
                piles.RemoveFirst();
            }

            if (deck.Count == 0)
                deck = new Deck();

            foreach (Deck pile in piles)
                deck.AddRange(pile);

            return new CardCollectionOperationResult(deck);
        }
开发者ID:cmackenzie,项目名称:FunProjects,代码行数:32,代码来源:CardShuffler.cs

示例7: Main

        public static void Main(string[] args)
        {
            int[] obj1 = Sort.GetIntArray(), obj2 = obj1, obj3 = obj1;
            Sort s_instance = new Sort();

            //选择排序
            s_instance.StartTimer();
            Sort.MaxSort(obj1);
            s_instance.StopTimer();

            //冒泡排序
            s_instance.StartTimer();
            Sort.BubbleSort(obj2);
            s_instance.StopTimer();

            //新组排序
            s_instance.StartTimer();
            Sort.InsertSort(obj3);
            s_instance.StopTimer();

            Console.ReadKey();

            Stack<int> s = new Stack<int>();
            Queue<int> q = new Queue<int>();
            foreach (int i in obj1)
            {
                s.Push(i);
            }
            foreach (int i in obj1)
            {
                q.Enqueue(i);
            }
            foreach (int i in s)
            {
                Console.WriteLine(i);
            }
            Console.ReadKey();
            foreach (int i in q)
            {
                Console.WriteLine(i);
            }
            Console.ReadKey();

            LinkedList<int> L = new LinkedList<int>();
            foreach (int i in obj1)
            {
                L.AddLast(i);
            }

            foreach (int i in L)
            {
                Console.WriteLine(i);

            }
            Console.WriteLine("First:"+L.First.Value);
            Console.WriteLine("555:"+L.ElementAt(555));
            Console.WriteLine("Last:"+L.Last.Value);
            Console.ReadKey();
        }
开发者ID:BrookT,项目名称:BrookT,代码行数:59,代码来源:Sort.cs

示例8: crearAutomata

        public void crearAutomata() 
        {
              Clases.Automata automata;
              LinkedList <String> oelista= new LinkedList<String>();
              oelista.AddFirst("a");
              oelista.AddFirst("b");

              
        LinkedList<Clases.Estado> listaEstado = new LinkedList<Clases.Estado>();
        listaEstado.AddLast(new Clases.Estado("Q0", new LinkedList<Clases.Transicion>(), false));
        listaEstado.AddLast(new Clases.Estado("Q1", new LinkedList<Clases.Transicion>(), false));
        listaEstado.AddLast(new Clases.Estado("Q2", new LinkedList<Clases.Transicion>(), true));
        listaEstado.AddLast(new Clases.Estado("Q3", new LinkedList<Clases.Transicion>(), false));
        listaEstado.AddLast(new Clases.Estado("Q4", new LinkedList<Clases.Transicion>(), true));
        listaEstado.AddLast(new Clases.Estado("Q5", new LinkedList<Clases.Transicion>(), false));
        listaEstado.AddLast(new Clases.Estado("Q6", new LinkedList<Clases.Transicion>(), false));
        listaEstado.ElementAt(0).listTransiciones.AddLast(new Clases.Transicion("Q0", "a", "Q2"));
        listaEstado.ElementAt(0).listTransiciones.AddLast(new Clases.Transicion("Q0", "b", "Q1"));
        listaEstado.ElementAt(1).listTransiciones.AddLast(new Clases.Transicion("Q1", "a", "Q0"));
        listaEstado.ElementAt(1).listTransiciones.AddLast(new Clases.Transicion("Q1", "b", "Q2"));
        listaEstado.ElementAt(2).listTransiciones.AddLast(new Clases.Transicion("Q2", "a", "Q3"));
        listaEstado.ElementAt(2).listTransiciones.AddLast(new Clases.Transicion("Q2", "b", "Q5"));
        listaEstado.ElementAt(3).listTransiciones.AddLast(new Clases.Transicion("Q3", "a", "Q6"));
        listaEstado.ElementAt(3).listTransiciones.AddLast(new Clases.Transicion("Q3", "b", "Q1"));
        listaEstado.ElementAt(4).listTransiciones.AddLast(new Clases.Transicion("Q4", "a", "Q3"));
        listaEstado.ElementAt(4).listTransiciones.AddLast(new Clases.Transicion("Q4", "b", "Q5"));
        listaEstado.ElementAt(5).listTransiciones.AddLast(new Clases.Transicion("Q5", "a", "Q6"));
        listaEstado.ElementAt(5).listTransiciones.AddLast(new Clases.Transicion("Q5", "b", "Q4"));
        listaEstado.ElementAt(6).listTransiciones.AddLast(new Clases.Transicion("Q6", "a", "Q2"));
        listaEstado.ElementAt(6).listTransiciones.AddLast(new Clases.Transicion("Q6", "b", "Q5"));
        automata= new Clases.Automata("auto1", "Q0", listaEstado,oelista);
       

        //minimizar(automata);
       /* reconocer("ababbb", automata);
        if (!isCompleto(automata)) 
        {
            completar(automata);
        }
        Console.WriteLine(automata.listEstados.ElementAt(automata.listEstados.Count-1).nombre);*/
        reverso(automata);
        }
开发者ID:zevaxt,项目名称:Automatas-0.1,代码行数:42,代码来源:Inicial.cs

示例9: calculateIDF

 private void calculateIDF(LinkedList<String> terms)
 {
     for (int i = 0; i < terms.Count; i++)
     {
         foreach (String doc in this.file_to_term_count.Keys)
         {
             if (this.file_to_term_count[doc].ContainsKey(terms.ElementAt(i)))
             {
                 if (this.docs_with_term.ContainsKey(terms.ElementAt(i)))
                 {
                     this.docs_with_term.Add(terms.ElementAt(i), this.docs_with_term[terms.ElementAt(i)] + 1);
                 }
                 else
                 {
                     this.docs_with_term.Add(terms.ElementAt(i), 1.0);
                 }
             }
         }
     }
 }
开发者ID:joegalley,项目名称:tf-idf,代码行数:20,代码来源:tfidf.cs

示例10: LlenarFormaPago

        public void LlenarFormaPago(){//Carga items de forma de pago
            listaFormaPago = new LinkedList<String>();
            listaFormaPago.AddFirst("Contado");
            listaFormaPago.AddLast("50% anticipo");
            listaFormaPago.AddLast("30 días");
            listaFormaPago.AddLast("Otro");

            for (int x = 0; x < listaFormaPago.Count(); x++){
                comboBox1.Items.Add(listaFormaPago.ElementAt(x).ToString());
            }
        }
开发者ID:fenrrid,项目名称:ProgramVisual,代码行数:11,代码来源:Form2.cs

示例11: LinkedListToString

 private void LinkedListToString(LinkedList<Triangle> linkedList, string fileFolder)
 {
     StreamWriter file = new StreamWriter(fileFolder);
     StringBuilder stringBuilder = new StringBuilder("Number\tType_Calculation\tValue\r\n");
     for (int i = 0; i < linkedList.Count; i++)
     {
         if (linkedList.ElementAt(i).Area != null)
         {
             stringBuilder.Append(i + 1 + "\tArea\t" + string.Format("{0,8:0.####}",
                 linkedList.ElementAt(i).Area).Trim() + "\r\n");
         }
         if (linkedList.ElementAt(i).Perimeter != null)
         {
             stringBuilder.Append(i + 1 + "\tPerimeter\t" + string.Format("{0,8:0.####}",
                 linkedList.ElementAt(i).Perimeter).Trim() + "\r\n");
         }
     }
     file.WriteLine(stringBuilder.ToString());
     file.Close();
 }
开发者ID:WeR58,项目名称:Lab_12_variant_1,代码行数:20,代码来源:StreamSaveDataGridView.cs

示例12: handle_state11

        static bool handle_state11(LinkedList<char> LaLista)
        {
            if (LaLista.ElementAt(3) == 'e')
            {
                return true;
            }

            else
            {
                return false;
            }
        }
开发者ID:nephtalidicochea,项目名称:Compiladores,代码行数:12,代码来源:Program.cs

示例13: LlenarListaProductos

        public void LlenarListaProductos(){//cargar items de productos

            ListaProductos = new LinkedList<String>();
            ListaProductos.AddFirst("computadora");
            ListaProductos.AddLast("calculadora");
            ListaProductos.AddLast("cacahuates");
            ListaProductos.AddLast("carro");

            for (int x = 0; x < ListaProductos.Count(); x++){
                comboBox2.Items.Add(ListaProductos.ElementAt(x).ToString());
            }
        }
开发者ID:fenrrid,项目名称:ProgramVisual,代码行数:12,代码来源:Form2.cs

示例14: hit_ground

        public bool hit_ground(Vector2 position, LinkedList<Stage> stages)
        {
            //Color[] collisionColor = new Color[screenHeight * screenWidth];
            for (int i = 0; i < stages.Count(); i++)
            {
                int shiftedX = (int)position.X - (int)stages.ElementAt(i).position.X;
                if (shiftedX > 0 && shiftedX < stages.ElementAt(i).width &&
                    position.Y < stages.ElementAt(i).height && position.Y > 0)
                {
                    //stages.ElementAt(i).cm.GetData<Color>(0, new Rectangle(shiftedX, (int)position.Y, 2, 2), collisionColor, 0, 4);
                    //stages.ElementAt(i).cm.GetData<Color>(collisionColor, shiftedX + ((int)position.Y * screenWidth), 1);
                    //stages.ElementAt(i).cm.GetData<Color>(collisionColor);

                    if (stages.ElementAt(i).collisionColor[shiftedX + ((int)position.Y * stages.ElementAt(i).width)] == Color.Black)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
开发者ID:epolekoff,项目名称:SynesthesiaChaos,代码行数:21,代码来源:Movable.cs

示例15: getTopTen

        //Needs a difficulty to be passed to it to find which set
        //of requirments to sort by
        //retrieves top 10 users based on based on wins and difficulty
        public static LinkedList<Profile> getTopTen()
        {
            LinkedList<Profile> profiles = new LinkedList<Profile>();
            String difficulty = "eWin";

            profiles = query("Select Top 10 userID, icon, eWin, eLoss, mWin, mLoss, hWin, hLoss From Users order by " + difficulty + " Desc;");

            //Debug for printing all profiles to console window
            for (int x = 0; x < profiles.Count; x++)
                Console.WriteLine(profiles.ElementAt(x) + "\n");

            return profiles;
        }
开发者ID:asdfasdf126,项目名称:Database,代码行数:16,代码来源:Db.cs


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