从上一个已知值增加列表 [英] Increment the list from the last known value
本文介绍了从上一个已知值增加列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像AncillariesList = new ObservableCollection< controldomain>();
的列表,它包含一个名为Lineno.So的值,如果列表包含大约20个值当最后一个值为1200时,我想从用户点击添加按钮时的最后一个值开始增加。我怎样才能实现这个目标?
解决方案
如果列表有值按递增顺序排列然后你可以这样做:
int lastVal = AncillariesList [AncillariesList.Count - 1 ];
现在在添加新会员时,您可以使用++ lastVal;
I have a list like AncillariesList = new ObservableCollection<controldomain>();
and it contains a value named Lineno.So if the list contains some 20 values and the last value is 1200, i want to increment from the last value when the user click on add button.How can i achieve this??
解决方案
If list has values in increasing order then you can do something like this:
int lastVal = AncillariesList[AncillariesList.Count - 1];
now while adding new member, you can use++lastVal;
这篇关于从上一个已知值增加列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文