本文整理汇总了C#中IList.WithKey方法的典型用法代码示例。如果您正苦于以下问题:C# IList.WithKey方法的具体用法?C# IList.WithKey怎么用?C# IList.WithKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.WithKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Alter
protected override void Alter(IList<MeasureDimension> entities)
{
base.Alter(entities);
entities.WithKey(x => x.SystemKeyword)
.Alter("mm", x =>
{
x.Name = "Millimeter";
x.Ratio = 0.001M;
})
.Alter("cm", x =>
{
x.Name = "Zentimeter";
x.Ratio = 0.01M;
})
.Alter("m", x =>
{
x.Name = "Meter";
x.Ratio = 1M;
})
.Alter("inch", x =>
{
x.Name = "Zoll";
x.Ratio = 0.0254M;
})
.Alter("ft", x =>
{
x.Name = "Fuß";
x.Ratio = 0.3048M;
});
}
示例2: Alter
protected override void Alter(IList<QuantityUnit> entities)
{
base.Alter(entities);
entities.WithKey(x => x.DisplayOrder)
.Alter(0, x =>
{
x.Name = "Stück";
x.Description = "Stück";
})
.Alter(1, x =>
{
x.Name = "Schachtel";
x.Description = "Schachtel";
})
.Alter(2, x =>
{
x.Name = "Paket";
x.Description = "Paket";
})
.Alter(3, x =>
{
x.Name = "Palette";
x.Description = "Palette";
});
}