本文整理汇总了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,
};
}
示例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);
}
示例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);
}
});
*/
}
示例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);
}