在日期时间集合列表中查找类似值的索引 [英] Find the index of similar value in a list of datetime collection

查看:77
本文介绍了在日期时间集合列表中查找类似值的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个日期时间集合的列表,我想找到所有类似日期时间的索引,如果我找到相似的值,我想添加一些额外的时间,使它不同像1-2-3分钟,但不要只是想加一个数字,因为如果我加一个常数它会再次相同:)

任何想法的人我都在.net 3.5



我尝试过的事情:



尝试一些不值得一提的事情

I have a list of datetime collection and i wanted to find the index of all the similar datetime in collection and if i find similar values i want to add some extra time to make it different like 1-2-3 minutes but dont just want to plus a number because if i plus a constant it will be same again :)
Any ideas guys i am on .net 3.5

What I have tried:

Trying something common not worth mentioning

推荐答案

谢谢伙计们:简短而简单

dtGLOScheduleDateTime是日期和时间的集合



Thanks Guys: done short and simple
dtGLOScheduleDateTime is a collection of date and time

private void AddOffset_DateTime()
       {
           int i, j;
           for (i = 0; i < dtGLOScheduleDateTime.Count; i++)
           {
             for(j=i+1;j < dtGLOScheduleDateTime.Count;j++)
             {
                 if (dtGLOScheduleDateTime[i] == dtGLOScheduleDateTime[j])
                 {
                     dtGLOScheduleDateTime[j] = dtGLOScheduleDateTime[j].AddMinutes(1*j);
                 }
             }
           }


这篇关于在日期时间集合列表中查找类似值的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆