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


C# KeyValuePair.First方法代码示例

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


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

示例1: DeserializeUser

 private static UserHeader DeserializeUser(KeyValuePair<string, string>[] propertyBag)
 {
     return new UserHeader
     {
         Id = new Guid(propertyBag.First(item => item.Key == IdProperty).Value),
         Email = propertyBag.First(item => item.Key == EMailProperty).Value,
         Role = ParseRole(propertyBag.First(item => item.Key == RoleProperty).Value),
         FirstName = propertyBag.First(item => item.Key == FirstNameProperty).Value,
         LastName = propertyBag.First(item => item.Key == LastNameProperty).Value,
     };
 }
开发者ID:Cognite-Soft,项目名称:ARB_2016_V2,代码行数:11,代码来源:SecurityTokenService.cs

示例2: OnNavigatedTo

        public override void OnNavigatedTo(KeyValuePair<string, string>[] argument = null)
        {
            Station station = App.AvailableStations.First(x => x.Title == argument.First(y => y.Key == "Station").Value);

            LoadSongHistory(station);

            base.OnNavigatedTo(argument);
        }
开发者ID:Amrykid,项目名称:Hanasu,代码行数:8,代码来源:SongHistoryViewModel.cs

示例3: loadObjects

        public void loadObjects(KeyValuePair<string, string>[] objects)
        {
            cachedObjects = new JsDictionary<string, LevelObject>();

            foreach (LevelObjectInfo t in SonicLevel.Objects)
            {
                var o = t.Key;
                if (cachedObjects.ContainsKey(o))
                {
                    t.SetObjectData(cachedObjects[o]);
                    continue;
                }
                var d = objects.First(p => p.Key == o);
                if (d.Falsey())
                {
                    t.SetObjectData(new LevelObject(o));
                    continue;
                }
                LevelObjectData dat;
                if (d.Value.Length == 0) dat = new LevelObjectData();
                else dat = (LevelObjectData)Json.Parse(d.Value);

                var dr = ObjectManager.ExtendObject(dat);
                cachedObjects[o] = dr;
                t.SetObjectData(dr);
            }

            /* 
        OurSonic.SonicLevels.getObjects(objectKeys, function (objects) {
            window.CachedObjects = [];
            for (l = 0; l < sonicManager.SonicLevel.Objects.length; l++) {
                o = sonicManager.SonicLevel.Objects[l].key;
                if (window.CachedObjects[o]) {
                    sonicManager.SonicLevel.Objects[l].setObjectData(window.CachedObjects[o]);
                    continue;
                }
                var d = JSLINQ(objects).First(function (p) { return p.key == o; });
                if (!d) {
                    sonicManager.SonicLevel.Objects[l].setObjectData(new LevelObject(o));
                    continue;
                }

                var dr = _H.extend(new LevelObject(""), jQuery.parseJSON(d.value));
                dr = sonicManager.objectManager.extendObject(dr);

                for (var n = 0; n < dr.assets.length; n++) {
                    for (var s = 0; s < dr.assets[n].frames.length; s++) {
                        dr.assets[n].frames[s].hurtSonicMap.length = dr.assets[n].frames[s].width;
                        dr.assets[n].frames[s].collisionMap.length = dr.assets[n].frames[s].width;
                        for (var t = 0; t < dr.assets[n].frames[s].hurtSonicMap.length; t++) {
                            dr.assets[n].frames[s].hurtSonicMap[t].length = dr.assets[n].frames[s].height;
                            dr.assets[n].frames[s].collisionMap[t].length = dr.assets[n].frames[s].height;

                        }
                    }
                }

                window.CachedObjects[o] = dr;
                sonicManager.SonicLevel.Objects[l].setObjectData(dr);

            }

        });

*/
        }
开发者ID:OurSonic,项目名称:OurSonicSharp,代码行数:66,代码来源:SonicManager.load.cs

示例4: Should_not_loose_headers

        public void Should_not_loose_headers()
        {
            var headers = new KeyValuePair<string, string>[0];
            _bus.SubscribeContextHandler<A>(ctx =>
            {
                headers = ctx.Headers.ToArray();
                _receivedA.Set();
            });

            _bus.ScheduleMessage(1.Seconds().FromUtcNow(), new A { Name = "Joe" },
                ctx =>
                {
                    ctx.SetHeader("ATest", "AValue");
                });

            Assert.IsTrue(_receivedA.WaitOne(Utils.Timeout), "Message A not handled");
            Assert.IsNotEmpty(headers, "No Headers were sent");
            Assert.AreEqual("AValue", headers.First(h => h.Key == "ATest").Value);
        }
开发者ID:jeppster,项目名称:MassTransit-Quartz,代码行数:19,代码来源:Service_Specs.cs


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