我List<string>喜欢:
List<String> lsRelation = new List<String>{"99","86","111","105"}.
Run Code Online (Sandbox Code Playgroud)
现在我想找到数字111,它是倒数第二个字符串.
所以我试过了:
String strSecondLast=lsrelation.Last() - 2;
Run Code Online (Sandbox Code Playgroud)
这不起作用.那么我怎样才能找到List的倒数第二个元素Last().
是否有可能从c#中的arraylist中获取唯一值?实际上我有一个包含值= 100,101,102,101,100,102,103的arraylist,但是我想要这样的唯一值,如100,101,102,103.那么什么是c#语法来从arralist中获取不同/唯一值?
我试过了
Arraylist Others=new Arraylist();
others=TakeanotherValues();
others.Distinct().Toarray();
Run Code Online (Sandbox Code Playgroud)
但是错误是'System.Collection.ArrayList不保留definct的定义'