IList比对问题 本帖最后由 imtns 于 2012-02-21 17:10:33 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 dList = list.Except(Submitted.Select(p=>p.Date)).ToList(); IList<DateTime> Submitted = new List<DateTime> { Convert.ToDateTime("2012-02-12 10:41:15"), Convert.ToDateTime("2012-02-13 09:56:45"), Convert.ToDateTime("2012-02-13 09:56:02"), Convert.ToDateTime("2012-02-15 14:23:46") }; var list = Enumerable.Range(0, DateTime.DaysInMonth(2012, 2)).Select(i => new DateTime(2012, 2, 1).AddDays(i)).ToList(); IList<DateTime> dList = new List<DateTime>(); list.Except(Submitted,new DateTimeCompare()).ToList().ForEach(x => Console.WriteLine(x.ToString("yyyy-MM-dd"))); public class DateTimeCompare : IEqualityComparer<DateTime> { #region IEqualityComparer<DateTime> 成员 public bool Equals(DateTime x, DateTime y) { if (x.ToString("yyyy-MM-dd").Equals(y.ToString("yyyy-MM-dd"))) return true; else return false; } public int GetHashCode(DateTime obj) { return obj.Year + obj.Month + obj.Day; } #endregion } 求解 C#调用fortran编写的DLL 出错 C# 图片压缩 C#调用SQL数据库存储过程的时候出错 哪里有免费的WebServices 天气预报? 跪求C#查看AD用户的代码, 在线等 如何在。NET中点击一个按扭之后弹出一个提示窗口(菜鸟问题) 请问用C#如何写一个流媒体播放器 winform 如何打开WORD SetWindowsHookEx失败的问题 我是个菜鸟,请问要用C#学写程序,需要装什么东东啊? 求助,关于字符串匹配 C# 按钮上添加一个小图标
var list = Enumerable.Range(0, DateTime.DaysInMonth(2012, 2)).Select(i => new DateTime(2012, 2, 1).AddDays(i)).ToList();
IList<DateTime> dList = new List<DateTime>();
list.Except(Submitted,new DateTimeCompare()).ToList().ForEach(x => Console.WriteLine(x.ToString("yyyy-MM-dd")));
public class DateTimeCompare : IEqualityComparer<DateTime>
{
#region IEqualityComparer<DateTime> 成员 public bool Equals(DateTime x, DateTime y)
{
if (x.ToString("yyyy-MM-dd").Equals(y.ToString("yyyy-MM-dd")))
return true;
else
return false;
} public int GetHashCode(DateTime obj)
{
return obj.Year + obj.Month + obj.Day;
} #endregion
}