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


C# IList.Sort方法代码示例

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


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

示例1: FullSpriteSet

 private FullSpriteSet( IList<AbstractSprite> sprites, System.ComponentModel.BackgroundWorker worker, int tasksComplete, int tasks )
 {
     bool haveWorker = worker != null;
     if ( haveWorker )
         worker.ReportProgress( ( tasksComplete++ * 100 ) / tasks, "Sorting" );
     sprites.Sort( ( a, b ) => a.Name.CompareTo( b.Name ) );
     this.sprites = sprites;
 }
开发者ID:Glain,项目名称:FFTPatcher,代码行数:8,代码来源:FullSpriteSet.cs

示例2: FieldAndTermEnumAnonymousInnerClassHelper

            public FieldAndTermEnumAnonymousInnerClassHelper(List<Term> terms)
            {
                if (!terms.Any())
                {
                    throw new ArgumentException("no terms provided");
                }

                this.terms = terms;
                terms.Sort();
                iter = terms.GetEnumerator();
            }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:TermsFilter.cs

示例3: FullSpriteSet

        private FullSpriteSet( IList<AbstractSprite> sprites, System.ComponentModel.BackgroundWorker worker, int tasksComplete, int tasks )
        {
            bool haveWorker = worker != null;
            if ( haveWorker )
                worker.ReportProgress( ( tasksComplete++ * 100 ) / tasks, "Sorting" );
            sprites.Sort( ( a, b ) => a.Name.CompareTo( b.Name ) );
            this.sprites = sprites;
            Thumbnails = new ImageList();
            Thumbnails.ImageSize = new System.Drawing.Size( 80, 48 );
            foreach ( var sprite in sprites )
            {
                if ( haveWorker )
                    worker.ReportProgress( ( tasksComplete++ * 100 ) / tasks, string.Format( "Generating thumbnail for {0}", sprite.Name ) );

                Thumbnails.Images.Add( sprite.Name, sprite.GetThumbnail() );
            }
        }
开发者ID:Wi150nZ,项目名称:lioneditor,代码行数:17,代码来源:FullSpriteSet.cs

示例4: FieldAndTermEnumAnonymousInnerClassHelper

 public FieldAndTermEnumAnonymousInnerClassHelper(List<Term> terms)
 {
     this.terms = terms;
     terms.Sort();
     iter = terms.GetEnumerator();
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:6,代码来源:TermsFilter.cs

示例5: FieldAndTermEnumAnonymousInnerClassHelper2

 public FieldAndTermEnumAnonymousInnerClassHelper2(string field, List<BytesRef> terms)
     : base(field)
 {
     this.terms = terms;
     terms.Sort();
     iter = terms.GetEnumerator();
 }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:7,代码来源:TermsFilter.cs

示例6: BindForecastDataUsage

        public void BindForecastDataUsage(int siteOrcatid, int activIndex)
        {
            DataRepository.SaveOrUpdateForecastInfo(_forecastInfo);

            _lvHistData.BeginUpdate();
            _lvHistData.Items.Clear();
            List<string> list = new List<string>();
            List<string> plist = new List<string>();
            List<int> plistId = new List<int>();

            if (_activeCategory != null || _activeFSite != null)
            {
                int index = 0;
                int productcount = 0;

                #region MyRegion
                if (_forecastInfo.GetListOfDataUsages(siteOrcatid, activIndex).Count > 0)
                {
                    if (_forecastInfo.Methodology == MethodologyEnum.CONSUMPTION.ToString())
                    {
                        if (_forecastInfo.DataUsage == DataUsageEnum.DATA_USAGE3.ToString())
                        {
                            productcatList = (IList<ForecastCategoryProduct>)_forecastInfo.GetListOfDataUsages(siteOrcatid, activIndex);
                            productListunsorted = productcatList[0].Id;
                            productcatList.Sort(delegate(ForecastCategoryProduct p1, ForecastCategoryProduct p2) { return p1.DurationDateTime.Value.Date.CompareTo(p2.DurationDateTime.Value.Date); });
                            productcount = productcatList.Count;
                            foreach (ForecastCategoryProduct p in productcatList)
                            {
                                if (list.Contains(p.CDuration) != true)
                                {
                                    list.Add(p.CDuration);
                                }
                                if (plist.Contains(p.Product.ProductName) != true)
                                {
                                    plist.Add(p.Product.ProductName);
                                    plistId.Add(p.Product.Id);
                                }
                                if (productListunsorted < p.Id)
                                    productListunsorted = p.Id;

                            }
                        }
                        else
                        {
                            productsiteList = (IList<ForecastSiteProduct>)_forecastInfo.GetListOfDataUsages(siteOrcatid, activIndex);
                            productListunsorted = productsiteList[0].Id;
                            productsiteList.Sort(delegate(ForecastSiteProduct p1, ForecastSiteProduct p2) { return p1.DurationDateTime.Value.Date.CompareTo(p2.DurationDateTime.Value.Date); });
                            productcount = productsiteList.Count;

                            foreach (ForecastSiteProduct p in productsiteList)
                            {
                                if (list.Contains(p.CDuration) != true)
                                {
                                    list.Add(p.CDuration);
                                }
                                if (plist.Contains(p.Product.ProductName) != true)
                                {
                                    plist.Add(p.Product.ProductName);
                                }
                                if (productListunsorted < p.Id)
                                    productListunsorted = p.Id;

                            }

                        }
                    }
                    else
                    {
                        if (_forecastInfo.DataUsage == DataUsageEnum.DATA_USAGE3.ToString())
                        {
                            testcatList = (IList<ForecastCategoryTest>)_forecastInfo.GetListOfDataUsages(siteOrcatid, activIndex);
                            testListunsorted = testcatList[0].Id;
                            testcatList.Sort(delegate(ForecastCategoryTest t1, ForecastCategoryTest t2) { return t1.DurationDateTime.Value.Date.CompareTo(t2.DurationDateTime.Value.Date); });
                            productcount = testcatList.Count;

                            foreach (ForecastCategoryTest t in testcatList)
                            {
                                if (list.Contains(t.CDuration) != true)
                                {
                                    list.Add(t.CDuration);
                                }
                                if (plist.Contains(t.Test.TestName) != true)
                                {
                                    plist.Add(t.Test.TestName);
                                    plistId.Add(t.Test.Id);
                                }
                                if (testListunsorted < t.Id)
                                    testListunsorted = t.Id;

                            }
                        }
                        else
                        {
                            testsiteList = (IList<ForecastSiteTest>)_forecastInfo.GetListOfDataUsages(siteOrcatid, activIndex);
                            testListunsorted = testsiteList[0].Id;
                            testsiteList.Sort(delegate(ForecastSiteTest t1, ForecastSiteTest t2) { return t1.DurationDateTime.Value.Date.CompareTo(t2.DurationDateTime.Value.Date); });
                            productcount = testsiteList.Count;

                            foreach (ForecastSiteTest t in testsiteList)
                            {
//.........这里部分代码省略.........
开发者ID:opianHealth,项目名称:ForLAB,代码行数:101,代码来源:BaseHistoricalData.cs

示例7: DoDteCrap

        private IList<PatchedByteArray> DoDteCrap( IList<ISerializableFile> dteFiles, BackgroundWorker worker, DoWorkEventArgs args, out IDictionary<byte, string> dteMapping )
        {
            List<PatchedByteArray> patches = new List<PatchedByteArray>();
            dteMapping = null;
            if (worker.CancellationPending)
            {
                args.Cancel = true;
                return null;
            }

            dteFiles.Sort( ( x, y ) => (y.ToCDByteArray().Length - y.Layout.Size).CompareTo( x.ToCDByteArray().Length - x.Layout.Size ) );
            if (worker.CancellationPending)
            {
                args.Cancel = true;
                return null;
            }

            IDictionary<ISerializableFile, Set<KeyValuePair<string, byte>>> filePreferredPairs = null;
            Set<KeyValuePair<string, byte>> currentPairs = null;

            DteResult result = DteResult.Empty;
            if (dteFiles.Count > 0)
            {
                int tries = dteFiles.Count;
                //DteResult result = DoDteForFiles( dteFiles, worker, args, out filePreferredPairs, out currentPairs );
                do
                {
                    result = DoDteForFiles( dteFiles, worker, args, out filePreferredPairs, out currentPairs );
                    switch (result.ResultCode)
                    {
                        case DteResult.Result.Cancelled:
                            args.Cancel = true;
                            return null;
                        case DteResult.Result.Fail:
                            var failedFile = result.FailedFile;
                            if (dteFiles[0] == failedFile)
                            {
                                // Failed on the first file... this is hopeless
                                throw new FFTPatcher.TextEditor.DTE.DteException( failedFile );
                            }

                            // Bump the failed file to the top of the list
                            dteFiles.Remove( failedFile );
                            dteFiles.Insert( 0, failedFile );
                            break;
                        case DteResult.Result.Success:
                            // do nothing
                            break;
                    }
                } while (result.ResultCode != DteResult.Result.Success && --tries >= 0);
            }

            switch (result.ResultCode)
            {
                case DteResult.Result.Fail:
                    throw new FFTPatcher.TextEditor.DTE.DteException( dteFiles[0] );
                case DteResult.Result.Cancelled:
                    args.Cancel = true;
                    return null;
            }

            foreach (var file in dteFiles)
            {
                worker.ReportProgress( 0,
                    new ProgressForm.FileProgress { File = file, State = ProgressForm.TaskState.Starting, Task = ProgressForm.Task.GeneratePatch } );
                var currentFileEncoding = PatcherLib.Utilities.Utilities.DictionaryFromKVPs( filePreferredPairs[file] );
                patches.AddRange( file.GetDtePatches( currentFileEncoding ) );
                worker.ReportProgress( 0,
                    new ProgressForm.FileProgress { File = file, State = ProgressForm.TaskState.Done, Task = ProgressForm.Task.GeneratePatch } );
                if (worker.CancellationPending)
                {
                    args.Cancel = true;
                    return null;
                }
            }

            var myDteMapping = new Dictionary<byte, string>();
            currentPairs.ForEach( kvp => myDteMapping[kvp.Value] = kvp.Key );
            dteMapping = myDteMapping;

            patches.AddRange( DTE.GenerateDtePatches( this.Filetype, currentPairs ) );
            return patches.AsReadOnly();
        }
开发者ID:Glain,项目名称:FFTPatcher,代码行数:83,代码来源:FFTText.cs

示例8: AddOrReplaceCharMapDirectoryEntry

 private void AddOrReplaceCharMapDirectoryEntry( IList<PatcherLib.Iso.DirectoryEntry> dir, PatcherLib.Iso.DirectoryEntry newDirEnt )
 {
     var currentCharmapIndex = dir.IndexOf( dir.Find( d => d.Filename == newDirEnt.Filename ) );
     if (currentCharmapIndex != -1)
     {
         dir[currentCharmapIndex] = newDirEnt;
     }
     else
     {
         dir.Add( newDirEnt );
         dir.Sort( ( a, b ) => a.Filename.CompareTo( b.Filename ) );
     }
 }
开发者ID:Glain,项目名称:FFTPatcher,代码行数:13,代码来源:FFTText.cs

示例9: UpdateTeamAssignmentDetail

        /// <summary>
        /// Updates the team assignment detail.
        /// </summary>
        /// <param name="projects">The projects.</param>
        /// <returns>
        /// returns the ProjectFillItem
        /// </returns>
        private IList<ProjectFillItem> UpdateTeamAssignmentDetail(IList<ProjectFillItem> projects)
        {
            if (this.developer != null)
            {
                this.clientsAndProjects = DependencyInjectionContainer.Instance.Container.Resolve<TimesheetService>().OrderClientsAndProjects(this.Clients, projects, this.developer.DeveloperID, this.currentDate);
                this.Clients = this.Clients.Sort();
                projects = projects.Sort();

                this.lastWorkDetail = DependencyInjectionContainer.Instance.Container.Resolve<TimesheetService>().RetrieveLastEntry(this.developer.DeveloperID);
            }

            return projects;
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:20,代码来源:StartTask.xaml.cs

示例10: FieldAndTermEnumAnonymousInnerClassHelper2

            public FieldAndTermEnumAnonymousInnerClassHelper2(string field, List<BytesRef> terms)
                : base(field)
            {
                if (!terms.Any())
                {
                    throw new ArgumentException("no terms provided");
                }

                this.terms = terms;
                terms.Sort();
                iter = terms.GetEnumerator();
            }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:12,代码来源:TermsFilter.cs

示例11: PopulateLists

        /// <summary>
        /// Populates the list entries.
        /// </summary>
        private void PopulateLists(
			int offset,
			IList<HighScoreEntry> list)
        {
            // Sort it
            list.Sort();

            // Go through the blow away the list
            for (int i = 0; i < HighScoreTable.MaximumEntries; i++)
            {
                // See if we have it
                int n = i + offset;

                if (i > list.Count - 1)
                {
                    entries[n].Reset();
                    continue;
                }

                // Populate the list
                entries[n].Name.Text = list[i].Name;
                entries[n].UtcWhen.Text = list[i].UtcWhen.ToString();
                entries[n].Word.Text = list[i].Word + "";
                entries[n].Score.Text = list[i].Score.ToString("N0");
            }
        }
开发者ID:dmoonfire,项目名称:wordplay,代码行数:29,代码来源:HighScoreWindow.cs


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