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


C# IList.First方法代码示例

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


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

示例1: MapXmlToDomain

        public Junction MapXmlToDomain(XmlJunction xmlJunction, IList<SplitTrack> subTracks)
        {
            SplitTrack defaultTrack = subTracks.First(subTrack => xmlJunction.BranchDefaultId.Equals(subTrack.Id));
            SplitTrack altTrack = subTracks.First(subTrack => xmlJunction.BranchAlternateId.Equals(subTrack.Id));

            return new Junction(xmlJunction.Id, defaultTrack, altTrack, xmlJunction.Direction);
        }
开发者ID:mANDROID99,项目名称:IaS,代码行数:7,代码来源:JunctionMapper.cs

示例2: UpdateManifest

 //exactly same as x.browser
 private static void UpdateManifest(IList<Services.Data.ExtensionManifestDataModel> found, IExtensionManifest ext)
 {
     if (found != null && found.Count() > 0)
     {
         ext.IsExtEnabled = found.First().IsExtEnabled;
         ext.LaunchInDockPositions = (ExtensionInToolbarPositions)found.First().LaunchInDockPositions;
         ext.FoundInToolbarPositions = (ExtensionInToolbarPositions)found.First().FoundInToolbarPositions;
     }
 }
开发者ID:liquidboy,项目名称:X,代码行数:10,代码来源:ExtensionUtils.cs

示例3: CurrencyRateViewMode

        public CurrencyRateViewMode(IList<CurrencyRate> rates)
        {
            var dollarSellingRate = rates.First(r => r.Type == TradeType.Selling && r.CurrencyName == "Dollar");
            var euroSellingRate = rates.First(r => r.Type == TradeType.Selling && r.CurrencyName == "Euro");
            var dollarBuyingRate = rates.First(r => r.Type == TradeType.Buying && r.CurrencyName == "Dollar");
            var euroBuyingRate = rates.First(r => r.Type == TradeType.Buying && r.CurrencyName == "Euro");

            SellingUsDollar = new RateKeyPair(dollarSellingRate.RateId){ExchangePrice =  dollarSellingRate.ExchangePrice};
            SellingEuro = new RateKeyPair(euroSellingRate.RateId) { ExchangePrice = euroSellingRate.ExchangePrice};
            BuyingUsDollar = new RateKeyPair(dollarBuyingRate.RateId) {ExchangePrice = dollarBuyingRate.ExchangePrice};
            BuyingEuro = new RateKeyPair(euroBuyingRate.RateId) { ExchangePrice = euroBuyingRate.ExchangePrice };
        }
开发者ID:masaad,项目名称:SyrianPoundWebSite,代码行数:12,代码来源:CurrencyRateViewMode.cs

示例4: CreateSection

 private Section CreateSection(IList<string> lines, int level)
 {
     string title = null;
     var headingMarker = new String('#', level) + " ";
     if (lines.First().StartsWith(headingMarker))
     {
         title = lines.First().TrimStart('#').Trim();
         lines.RemoveAt(0);
     }
     var furtherLevelMarkers = new String('#', level + 1);
     return lines.Any(x => x.StartsWith(furtherLevelMarkers))
         ? new Section(level, title, BreakDownSection(lines, level + 1).ToList())
         : new Section(level, title, string.Join(Environment.NewLine, lines));
 }
开发者ID:adamralph,项目名称:Automation.Engineering,代码行数:14,代码来源:MarkdownDocument.cs

示例5: Statistics

        public Statistics(IList<IVehicle> vehicles, bool removeOutliers = true)
        {
            if (vehicles == null || !vehicles.Any())
                throw new ArgumentException("Vehicles is null or count is 0. Must be greater than 0");

            _vehicles = vehicles;
            _outlierVehicles = new List<OutlierVehicle>();
            Make = _vehicles.First().Make;
            Model = _vehicles.First().Model;

            if (removeOutliers)
            {
                RemoveOutliers();
            }
        }
开发者ID:badokun,项目名称:vehicleanalysis,代码行数:15,代码来源:Statistics.cs

示例6: GetHourlyEnergyMeasure

 public Measure GetHourlyEnergyMeasure(IList<Measure> sourceMeasures, string hourMeasureSource, string hourDataVariable)
 {
     var dataVariable = hourDataVariable;
     var measurePercentage = 1;
     var plant = sourceMeasures.First().Plant;
     var reliability = 0;
     var resolution = getHourResolution();
     var source = hourMeasureSource;
     var utcDate = sourceMeasures.First().UtcDate;
     var utcHour = sourceMeasures.First().UtcHour;
     var utcMinute = 00;
     var utcSecond = 00;
     var value = getValue(sourceMeasures);
     return new Measure(plant, source, dataVariable, utcDate, utcHour, utcMinute, utcSecond, value, measurePercentage, reliability, resolution);
 }
开发者ID:jorgevr,项目名称:EXIMPROD,代码行数:15,代码来源:MeasureProcesser.cs

示例7: SortItems

        /// <summary>
        /// Sort the items by their priority and their index they currently exist in the collection
        /// </summary>
        /// <param name="files"></param>
        /// <returns></returns>
        public static IList<IClientDependencyFile> SortItems(IList<IClientDependencyFile> files)
        {
            //first check if each item's order is the same, if this is the case we'll make sure that we order them 
            //by the way they were defined
            if (!files.Any()) return files;

            var firstPriority = files.First().Priority;

            if (files.Any(x => x.Priority != firstPriority))
            {
                var sortedOutput = new List<IClientDependencyFile>();
                //ok they are not the same so we'll need to sort them by priority and by how they've been entered
                var groups = files.GroupBy(x => x.Priority).OrderBy(x => x.Key);
                foreach (var currentPriority in groups)
                {
                    //for this priority group, we'll need to prioritize them by how they are found in the files array
                    sortedOutput.AddRange(currentPriority.OrderBy(files.IndexOf));
                }
                return sortedOutput;
            }

            //they are all the same so we can really just return the original list since it will already be in the 
            //order that they were added.
            return files;
        } 
开发者ID:dufkaf,项目名称:ClientDependency,代码行数:30,代码来源:DependencySorter.cs

示例8: FeedResult

        private FeedResult FeedResult(IList<SyndicationItem> items)
        {
            var settings = Settings.GetSettings<FunnelWebSettings>();

            Debug.Assert(Request.GetOriginalUrl() != null, "Request.GetOriginalUrl() != null");

            var baseUri = Request.GetOriginalUrl();
            var feedUrl = new Uri(baseUri, Url.Action("Recent", "Wiki"));
            return new FeedResult(
                new Atom10FeedFormatter(
                    new SyndicationFeed(settings.SiteTitle, settings.SearchDescription, feedUrl, items)
                    {
                        Id = baseUri.ToString(),
                        Links =
                        {
                            new SyndicationLink(baseUri)
                            {
                                RelationshipType = "self"
                            }
                        },
                        LastUpdatedTime = items.Count() == 0 ? DateTime.Now : items.First().LastUpdatedTime
                    }), items.Max(i => i.LastUpdatedTime.LocalDateTime))
            {
                ContentType = "application/atom+xml"
            };
        }
开发者ID:nategreenwood,项目名称:nategreenwood.com,代码行数:26,代码来源:FeedController.cs

示例9: Create

        public static MapRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ContextFacade contextFacade, IList<ContextFacade> contexts, Format format, RestControlFlags flags, MediaTypeHeaderValue mt) {
            var memberValues = contexts.Select(c => new OptionalProperty(c.Id, GetMap(oidStrategy, req, c, flags))).ToList();
            IObjectFacade target = contexts.First().Target;
            MapRepresentation mapRepresentation;

            if (format == Format.Full) {
                var tempProperties = new List<OptionalProperty>();

                if (!string.IsNullOrEmpty(contextFacade?.Reason)) {
                    tempProperties.Add(new OptionalProperty(JsonPropertyNames.XRoInvalidReason, contextFacade.Reason));
                }

                var dt = new OptionalProperty(JsonPropertyNames.DomainType, target.Specification.DomainTypeName(oidStrategy));
                tempProperties.Add(dt);

                var members = new OptionalProperty(JsonPropertyNames.Members, Create(memberValues.ToArray()));
                tempProperties.Add(members);
                mapRepresentation = Create(tempProperties.ToArray());
            }
            else {
                mapRepresentation = Create(memberValues.ToArray());
            }

            mapRepresentation.SetContentType(mt);

            return mapRepresentation;
        }
开发者ID:NakedObjectsGroup,项目名称:NakedObjectsFramework,代码行数:27,代码来源:ArgumentsRepresentation.cs

示例10: AugmentCompletionSession

        public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
        {
            if (IsHtmlFile && completionSets.Any())
            {
                var bottomSpan = completionSets.First().ApplicableTo;
                if (!JScriptEditorUtil.IsInJScriptLanguageBlock(_lbm, bottomSpan.GetStartPoint(bottomSpan.TextBuffer.CurrentSnapshot)))
                {
                    // This is an HTML statement completion session, so do nothing
                    return;
                }
            }

            // TODO: Reflect over the ShimCompletionSet to see where the Description value comes from
            //       as setting the property does not actually change the value.
            var newCompletionSets = completionSets
                .Select(cs => cs == null ? cs : new ScriptCompletionSet(
                    cs.Moniker,
                    cs.DisplayName,
                    cs.ApplicableTo,
                    cs.Completions
                        .Select(c => c == null ? c : new Completion(
                            c.DisplayText,
                            c.InsertionText,
                            DocCommentHelper.ProcessParaTags(c.Description),
                            c.IconSource,
                            c.IconAutomationText))
                        .ToList(),
                    cs.CompletionBuilders))
                .ToList();
            
            completionSets.Clear();

            newCompletionSets.ForEach(cs => completionSets.Add(cs));
        }
开发者ID:sanyaade-mobiledev,项目名称:ASP.NET-Mvc-2,代码行数:34,代码来源:ScriptCompletionReplacementSource.cs

示例11: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            Loaded += (sender, e) => ClearValue(SizeToContentProperty);

            _allControllerViewModels =
                (from type in GetType().Assembly.GetTypes()
                 where !type.IsInterface && typeof(IController).IsAssignableFrom(type)
                 let viewModel = new ControllerViewModel((IController)Activator.CreateInstance(type))
                 orderby viewModel.SortIndex, viewModel.Library, viewModel.Description
                 select viewModel).ToList();
            _allControllerViewModels.First().IsChecked = true;
            ControllerGroups.ItemsSource = _allControllerViewModels.GroupBy(viewModel => viewModel.Library);

            _allResolutionViewModels = new[] {
                new ResolutionViewModel(800, 600, 50, 42),
                new ResolutionViewModel(1024, 768, 64, 54),
                new ResolutionViewModel(1280, 1024, 80, 73),
                new ResolutionViewModel(1440, 900, 90, 64),
            };
            _allResolutionViewModels.Last(
                res => res.Width <= SystemParameters.PrimaryScreenWidth &&
                res.Height <= SystemParameters.PrimaryScreenHeight).IsChecked = true;
            Resolutions.ItemsSource = _allResolutionViewModels;

            RunResults.ItemsSource = _runResults;
        }
开发者ID:joewhite,项目名称:Game-graphics,代码行数:27,代码来源:MainWindow.xaml.cs

示例12: CheckFirstAndLastPoint

 private void CheckFirstAndLastPoint(IList<Point> points)
 {
     if (this.DistanceIsTooSmall(points.Last(), points.First()))
     {
         points.RemoveAt(points.Count - 1);
     }
 }
开发者ID:an83,项目名称:KinectTouch2,代码行数:7,代码来源:LineThinner.cs

示例13: Filter

        public IList<DepthPointEx> Filter(IList<DepthPointEx> points)
        {
            IList<DepthPointEx> result = new List<DepthPointEx>();

            if (points.Count > 0)
            {
                var point = new DepthPointEx(points.First());
                result.Add(point);

                foreach (var currentSourcePoint in points.Skip(1))
                {
                    if (!PointsAreClose(currentSourcePoint, point))
                    {
                        point = new DepthPointEx(currentSourcePoint);
                        result.Add(point);
                    }
                }

                if (result.Count > 1)
                {
                    CheckFirstAndLastPoint(result);
                }
            }

            return result;
        }
开发者ID:guozanhua,项目名称:Kinect-Finger-Tracking,代码行数:26,代码来源:PointFilter.cs

示例14: Update

        public int Update(AdoAdapter adapter, string tableName, IList<IDictionary<string, object>> data, IDbTransaction transaction, IList<string> keyFields)
        {
            int count = 0;
            if (data == null) throw new ArgumentNullException("data");
            if (data.Count < 2) throw new ArgumentException("UpdateMany requires more than one record.");

            if (keyFields.Count == 0) throw new NotSupportedException("Adapter does not support key-based update for this object.");
            if (!AllRowsHaveSameKeys(data)) throw new SimpleDataException("Records have different structures. Bulk updates are only valid on consistent records.");
            var table = adapter.GetSchema().FindTable(tableName);

            var exampleRow = new Dictionary<string, object>(data.First(), HomogenizedEqualityComparer.DefaultInstance);

            var commandBuilder = new UpdateHelper(adapter.GetSchema()).GetUpdateCommand(tableName, exampleRow,
                                                                    ExpressionHelper.CriteriaDictionaryToExpression(
                                                                        tableName, GetCriteria(keyFields, exampleRow)));

            using (var connectionScope = ConnectionScope.Create(transaction, adapter.CreateConnection))
            using (var command = commandBuilder.GetRepeatableCommand(connectionScope.Connection))
            {
                var propertyToParameterMap = CreatePropertyToParameterMap(data, table, command);

                foreach (var row in data)
                {
                    foreach (var kvp in row)
                    {
                        propertyToParameterMap[kvp.Key].Value = kvp.Value ?? DBNull.Value;
                    }
                    count += command.ExecuteNonQuery();
                }
            }

            return count;
        }
开发者ID:darrencauthon,项目名称:Simple.Data,代码行数:33,代码来源:BulkUpdater.cs

示例15: CheckFirstAndLastPoint

 private void CheckFirstAndLastPoint(IList<DepthPointEx> points)
 {
     if (PointsAreClose(points.Last(), points.First()))
     {
         points.RemoveAt(points.Count - 1);
     }
 }
开发者ID:guozanhua,项目名称:Kinect-Finger-Tracking,代码行数:7,代码来源:PointFilter.cs


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