我将属性类型从List<T>更改为IReadOnlyList<T>,但我使用的是List<T>.Find()方法,现在编译器提供了error CS1061: 'IReadOnlyList<T>' doesdefinition for 'Find' and no accessible extension method 'Find' accepting a first
我正在从enum填充MVC4中的DropDownList,并且我希望将枚举值从最大到最小排序。然而,似乎没有一种直接的方法来解决这个问题。目前,我正在使用以下代码添加到字典中,键是ID,值是显示文本:
var priorities = Enum.GetValues(typeof(Models.Priority)).OfType<Models.Priority枚举中只有四个值,但是有没有更好的方法对从Enum.GetValues返回的内容执行OrderBy操作?我知道这样做可能对性能的影响很小,但我想