C# - 返回List中值最小的对象

时间:2017-06-21 19:06:07

标签: c# list min

我想要返回金额最低的package Fridge.Freezer; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }

User

但我需要的是 List<User> users = new List<User>(); users.Add(new User("Patrick", 39m)); users.Add(new User("Claude", 13.7m)); users.Add(new User("Steven", -45.3m)); Decimal lowest = users.Min(user => user.Amount); //this gives me -45.3m ,我需要-45.3m

1 个答案:

答案 0 :(得分:0)

这样的事情......只需遍历列表并找到最小的数量。

p {
 color: white;
 font-family: "Helvetica";
 font-size: 1.3em;
 margin: 10px auto;
 white-space: nowrap;
 overflow: hidden;
 width: 0px
}
.main1 {
  animation: type 4s 0s forwards steps(60, end);
}
.main2 {
  animation: type2 4s 4s forwards steps(60, end);
}
.main3 {
  animation: type3 4s 8s forwards steps(60, end);
}
@keyframes type{
 from { width: 0; }
 to { width: 430px; }
}
@keyframes type2{
 from { width: 0; }
 to { width: 224px; }
}
@keyframes type3{
 from { width: 0; }
 to { width: 364px; }
}
相关问题