本文整理汇总了C#中System.Linq.ElementAt方法的典型用法代码示例。如果您正苦于以下问题:C# System.Linq.ElementAt方法的具体用法?C# System.Linq.ElementAt怎么用?C# System.Linq.ElementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq
的用法示例。
在下文中一共展示了System.Linq.ElementAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToStandardMeasures_DecimalWithUnitConversion_ReturningConvertedStandardMeasures
public void ToStandardMeasures_DecimalWithUnitConversion_ReturningConvertedStandardMeasures()
{
var measures = new[] { 1.0m, 2.0m, 3.0m, -2.0m }.Cast(ElectricCurrent.MilliAmpere);
var expected = new ElectricCurrent(0.002m);
var actual = measures.ElementAt(1);
MeasureAssert.MeasuresAreEqual(expected, actual);
}
示例2: ToStandardMeasures_DoubleNoUnitConversion_ReturningNonConvertedStandardMeasures
public void ToStandardMeasures_DoubleNoUnitConversion_ReturningNonConvertedStandardMeasures()
{
var measures = new[] { 1.0, 2.0, 3.0, -2.0 }.Cast<Length>();
var expected = new Length(3.0);
var actual = measures.ElementAt(2);
MeasureAssert.MeasuresAreEqual(expected, actual);
}
示例3: ThrowExceptionOnElementAt1
private static void ThrowExceptionOnElementAt1()
{
var numbers = new[] { 3, 4 };
numbers.ElementAt(3);
}
示例4: SubscribeAppeal
private void SubscribeAppeal()
{
var appeals = new[] { 1, 2 }.ToArray();
this.UpdateAsObservable()
.Where(_ => canMove && isStableGround)
.Where(_ => Input.GetButtonDown("Appeal"))
.Select(_ => appeals.ElementAt(Random.Range(0, appeals.Length)))
.Subscribe(no =>
{
animator.SetFloat("appeal_no", no);
animator.SetTrigger("appeal");
});
}