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


C# List.RemoveAt方法代码示例

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


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

示例1: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ScrollViewer.SetVerticalScrollMode(CategoryPageGridView, ScrollMode.Disabled);
            CategoryPageViewModel categoryPageViewModel =
                           (CategoryPageViewModel)Resources["CategoryPageViewModel"];
            NavigationItem navigationItem = e.Parameter as NavigationItem;
            var task = Task.Factory.StartNew(async () =>
            {
                var bundle = await DownloadNavigationItem(navigationItem.ReferralId);
                var navigationItems = await DownloadNavigationItemsAsync();

                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High,
                    () =>
                    {
                        categoryPageViewModel.Content = bundle.Content[0];
                        var items =  new List<Content>(bundle.Content);
                        items.RemoveAt(0);
                        bundle.Content = items.ToArray();
                        categoryPageViewModel.Bundle = bundle;
                        categoryPageViewModel.NavigationItems = navigationItems;
                        LoadingGrid.Visibility = Visibility.Collapsed;
                        MySplitView.Visibility = Visibility.Visible;
                    }
                );
            });
            base.OnNavigatedTo(e);
        }
开发者ID:arnvanhoutte,项目名称:DeRedactie,代码行数:27,代码来源:CategoryPage.xaml.cs

示例2: GetExchangePeriodsMergedByMovementDirectoryFromEndDate

        /// <summary>
        /// Metoda zwracająca listę okresów notowań połączonych, jeżeli mają ten sam kierunek trendu. Metoda ta rozpoczyna wyznaczanie od parametru periodsEndDate i zmierza ku przeszłości.
        /// </summary>
        /// <param name="DesiredNumberOfPeriods">Oczekiwana liczba okresów.</param>
        /// <param name="periodsEndDate">Ostatnia data okresów.</param>
        /// <param name="periodsStartDate">Data będąca granicą wyznaczania kolejnych okresów.</param>
        /// <param name="daysInterval">Liczba określająca długość okresu w dniach.</param>
        /// <returns>Lista okresów notowań połaczonych, jeżeli mają ten sam kierunek trendu.</returns>
        public List<ExchangePeriod> GetExchangePeriodsMergedByMovementDirectoryFromEndDate(int DesiredNumberOfPeriods, DateTime periodsEndDate, DateTime periodsStartDate, int daysInterval)
        {
            DateTime iterationDate = periodsEndDate.Date;
            string dataPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\data\\";
            List<ExchangePeriod> periodList = new List<ExchangePeriod>();
            while (iterationDate >= periodsStartDate)
            {
                DateTime periodStart;
                if (iterationDate.AddDays(-daysInterval) > periodsStartDate)
                {
                    periodStart = iterationDate.AddDays(-daysInterval);
                }
                else
                {
                    periodStart = periodsStartDate.Date;
                }

                ExchangePeriod period = GetExchangePeriod(periodStart, iterationDate);
                if (period != null)
                {

                    period.PublicTrading -= GetExchangeDay(period.PeriodStart).PublicTrading;
                    if (periodList.Count != 0)
                    {
                        periodList.First().OpenRate = period.CloseRate;

                        //If percentage changes have the same sign.
                        if ((periodList.First().PercentageChange * period.PercentageChange) > 0 || periodList.First().PeriodStart == periodList.First().PeriodEnd)
                        {
                            periodList.First().PublicTrading += period.PublicTrading;
                            if (period.PeriodEnd != periodList.First().PeriodStart)
                            {
                                periodList.First().PublicTrading += GetExchangeDay(periodList.First().PeriodStart).PublicTrading;
                            }

                            periodList.First().PeriodStart = period.PeriodStart;
                            if ((periodList.Count > 1) && ((periodList[0].PercentageChange * periodList[1].PercentageChange) > 0))
                            {
                                periodList[1].OpenRate = periodList[0].OpenRate;
                                periodList[1].PeriodStart = periodList[0].PeriodStart;
                                periodList[1].PublicTrading += periodList[0].PublicTrading + GetExchangeDay(periodList[1].PeriodStart).PublicTrading;
                                periodList.RemoveAt(0);
                            }
                        }
                        else
                        {
                            if (periodList.Count == DesiredNumberOfPeriods + 1)
                            {
                                periodList.RemoveAt(0);
                                break;
                            }

                            periodList.Insert(0, period);
                        }
                    }
                    else
                    {
                        periodList.Add(period);
                    }
                }

                iterationDate = iterationDate.AddDays(-daysInterval);
            }

            return periodList;
        }
开发者ID:sharpgienek,项目名称:Polsl-BMMSI-Predict-WIG20-longterm-trend,代码行数:74,代码来源:DataProvider.cs

示例3: getRandomTopicIds

 private string getRandomTopicIds(int count, List<int> list)
 {
     string result = "";
     List<int> cloneList = new List<int>(list);
     if (count >= cloneList.Count)
     {
         foreach (int id in cloneList)
         {
             result += id + ",";
         }
     }
     else
     {
         Random random = new Random();
         for (int i = 0; i< count; i++)
         {
             int r = random.Next(cloneList.Count);
             result += cloneList[r] + ",";
             cloneList.RemoveAt(r);
         }
     }
     //if (result != "")
     //{
     //    result = result.Substring(0, result.Length - 1);
     //}
     return result;
 }
开发者ID:yaopengchao,项目名称:tcz,代码行数:27,代码来源:AddExam3.cs

示例4: UpOrder

        private void UpOrder(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count > 0)
            {
                listOrder = dataGridView.DataSource as List<SearchOrder>;

                int index = dataGridView.SelectedRows[0].Index;
                if (index >= 1)
                {
                    var temp = listOrder[index];
                    listOrder.RemoveAt(index);
                    listOrder.Insert(index - 1, temp);

                    dataGridView.ClearSelection();
                    dataGridView.Rows[index - 1].Selected = true;
                    dataGridView.Refresh();
                }
            }
        }
开发者ID:chauit,项目名称:ElectronicStore,代码行数:19,代码来源:DeliveryForm.cs

示例5: CreateNetworks


//.........这里部分代码省略.........
                    testDataList.Add(td);
                }
            }

            List<TrainingData> trainingDataList = new List<TrainingData>();
            foreach (TrainingDataFileParameters file in fileList)
            {
                TrainingData td = new TrainingData();
                if (td.ReadTrainFromFile(trainDataFolder.Split('\\').Last() + "\\" + file.FileName))
                {
                    trainingDataList.Add(td);
                }
            }

            string initStatus = this.InitializationStatus;
            Directory.CreateDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + path);
            List<Task> taskList = new List<Task>();
            NeuralNet.CallbackType[] callbacksArray = new NeuralNet.CallbackType[this.MaxComputingThreads];
            Semaphore threadProgressSemaphore = new Semaphore(1, 1);
            Semaphore allSem = new Semaphore(1, 1);
            TrainingData[] threadDataVars = new TrainingData[this.MaxComputingThreads];
            for (int i = 1; i <= this.MaxComputingThreads; i++)
            {
                int taskNumber = i;
                threadDataVars[i - 1] = new TrainingData();

                Task t = new Task((Action)(
                    () =>
                    {
                        while (true)
                        {
                            allSem.WaitOne();
                            if (parameters.Count == 0)
                            {
                                this.InitializationStatus = initStatus + " " + numberOfNetworksToCreate.ToString() + " / " + numberOfNetworksToCreate.ToString();
                                this.InitializationProgress = 100;
                                break;
                            }
                            else
                            {
                                NeuralNetworkParameters usedParameters = parameters.First();
                                parameters.RemoveAt(0);
                                if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + path + usedParameters.FileName))
                                {
                                    NeuralNet net = new NeuralNet();
                                    List<uint> layers = new List<uint>();
                                    layers.Add((uint)((usedParameters.fileParameters.NumberOfPeriods * 2) - 1)); // inputs
                                    layers.Add((uint)(layers[0] * usedParameters.hiddenLayersMultiplier)); // hidden
                                    layers.Add(3); // output
                                    net.CreateStandardArray(layers.ToArray());
                                    net.SetLearningRate((float)0.7);
                                    net.SetActivationFunctionHidden(ActivationFunction.SigmoidSymmetric);
                                    net.SetActivationFunctionOutput(ActivationFunction.SigmoidSymmetric);

                                    net.Callback += callbacksArray[taskNumber - 1];
                                    threadDataVars[taskNumber - 1] = trainingDataList.Find((e) => ((e.NumInputTrainData == layers[0]) && (e.Input.Length == usedParameters.fileParameters.NumberOfPatterns)));
                                    allSem.Release();
                                    net.TrainOnData(threadDataVars[taskNumber - 1],
                                            usedParameters.maxEpochs, // max iterations
                                            0,// iterations between report
                                            0 //desired error
                                            );
                                    allSem.WaitOne();
                                    net.TestData(testDataList.Find((e) => e.NumInputTrainData == layers[0]));
                                    double mse = net.GetMSE();
                                    if (lowestNetworkMSE == null || lowestNetworkMSE.MSE > mse)
                                    {
                                        lowestNetworkMSE = new NetworkMSE()
                                        {
                                            MSE = mse,
                                            NetworkFileName = usedParameters.FileName
                                        };

                                        StringWriter writer = new StringWriter();

                                        XmlSerializer serializer = new XmlSerializer(typeof(NetworkMSE));
                                        serializer.Serialize(writer, lowestNetworkMSE);
                                        File.WriteAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + path + "LowestMSENetwork.xml", writer.ToString());
                                    }

                                    net.Save(path + usedParameters.FileName);
                                }
                                this.InitializationStatus = initStatus + " " + numberOfCreatedNetworks.ToString() + " / " + numberOfNetworksToCreate.ToString();
                                numberOfCreatedNetworks++;
                                this.InitializationProgress = (numberOfCreatedNetworks * methodProgressPart / numberOfNetworksToCreate) + methodStartProgress;

                            }
                            allSem.Release();
                        }
                    }
                    ), TaskCreationOptions.LongRunning
                    );
                taskList.Add(t);
            }

            foreach (Task t in taskList)
            {
                t.Start();
            }
        }
开发者ID:sharpgienek,项目名称:Polsl-BMMSI-Predict-WIG20-longterm-trend,代码行数:101,代码来源:MainControler.cs

示例6: DrawOperation

        public static void DrawOperation(OpenGL gl, Project testProject, Vector rotation, List<List<double[]>> detailCache)
        {
            var bill = testProject.Settings;

            gl.Translate(bill.Length / 2, bill.Height / 2, bill.Width / 2);//высчитывается из размера заготовки
            gl.Rotate((float)rotation.Y, (float)rotation.X, 0); // вращение с зажатой средней кнопкой мыши
            gl.Translate(-bill.Length / 2, -bill.Height / 2, -bill.Width / 2);

            //var Bill = this.testProject.Settings;
            Billet.Draw(gl, bill.Height, bill.Length, bill.Width); // заготовка

            var operations = testProject.Operations;//колличество операций

            var boltReg = new Regex("BoltHole");
            var pocketReg = new Regex("Pocket");
            if (detailCache.Count != operations.Count) detailCache.Clear();

            for (var i = 0; i < operations.Count; i++)//главный цикл отрисовки
            {
                var shapeName = operations[i].Shape.Name;

                if (boltReg.IsMatch(shapeName))
                {
                    var bolt = (Model.Primitives.BoltHole)operations[i].Shape;
                    var boltlocation = operations[i].Location.LocationsList.GetEnumerator();
                    while (boltlocation.MoveNext())
                    {
                        if (bolt.Modified || boltlocation.Current.Modified || detailCache.Count<=i)
                        {

                            try
                            {
                                detailCache.RemoveAt(i);
                            }
                            catch{}
                            var location = new Point(boltlocation.Current.X, boltlocation.Current.Y);
                            detailCache.Insert(i, BoltHole.ReCalc(bolt, 0.5, location)); //здесь уже всё ок, кроме величины шага
                            boltlocation.Current.IsDrawn();
                            bolt.IsDrawn();//значит в кэше лежит актуальная информация
                        }
                        else
                        {
                            var location = new Point(boltlocation.Current.X, boltlocation.Current.Y);
                            BoltHole.Draw(gl, detailCache[i]); //здесь уже всё ок, кроме величины шага
                        }
                    }
                }

                if (!pocketReg.IsMatch(shapeName)) continue;
                var poc = (Model.Primitives.Pocket)operations[i].Shape;
                var poclocation = operations[i].Location.LocationsList.GetEnumerator();
                while (poclocation.MoveNext())
                {
                    if (poc.Modified || poclocation.Current.Modified || detailCache.Count <= i)
                    {
                        try
                        {
                            detailCache.RemoveAt(i);
                        }
                        catch { }
                        var location = new Point(poclocation.Current.X, poclocation.Current.Y);
                        var p = Pocket.ReCalc(poc, 0.5, location);
                        detailCache.Insert(i, p); //здесь уже всё ок, кроме величины шага
                        poclocation.Current.IsDrawn();
                        poc.IsDrawn();//значит в кэше лежит актуальная информация
                    }
                    else
                    {
                        var location = new Point(poclocation.Current.X, poclocation.Current.Y);
                        Pocket.Draw(gl, detailCache[i]); //здесь уже всё ок, кроме величины шага
                    }
                }
            }

            //отрисовщик траекторий
            gl.Begin(OpenGL.GL_LINE_STRIP);
            gl.Color(1f, 0, 0);

            var trajectorys = GCodeGenerator.TrajectoryStor.GetTrajectorys();
            foreach (var point in trajectorys.SelectMany(operation => operation))
            {
                gl.Vertex(point.GetCoordinates());
            }
        }
开发者ID:KyMaP13,项目名称:sharpcam,代码行数:84,代码来源:OperationDrawer.cs


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