f# - 如何将从数据库返回的日期与日期(字符串或其他)进行比较?

标签 f#

我有一个很大的 flinq 查询,除其他外,它返回一个对话开始的日期。我只想返回 2011 年 1 月 1 日之后开始的对话。

我有这样的事情:

conversation.TimeOfInitiation > "1-1-2011"

但我收到此错误:

The type System.Nullable<System.DateTime> does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface



显然我的幼稚方法没有成功。我该如何解决这个问题?

最佳答案

http://msdn.microsoft.com/en-us/library/72cec0e0.aspx

你必须得到值(value)。 Nullable 基本上是一个带有值的通用容器。

关于f# - 如何将从数据库返回的日期与日期(字符串或其他)进行比较?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4661938/

相关文章:

list - 在列表列表中排序列表 F#

f# - 如何从 fsx 脚本文件使用 FSharpChart

f# - 嵌套类型提供者

asynchronous - 异步读取/写入数据

generics - 通用 F# 函数 : How to get the Type of an F# Discriminated Union?

asynchronous - F#:async{} block 内的正确 `try` block ?

.net - F# 交互式 GC 堆转储

c# - F# 2.0 中的错误与泛型类型参数的约束在哪里有关?

f# - 避免指示状态的可变 bool 值

f# - 光线追踪 F# - 缺少三角形会在图 : Hit properly? 中产生孔洞