Cache.Count 空引用??

Jueyoung 2012-04-13 07:06:37

Public Shared ReadOnly Property AllMessages As List(Of Message)
Get
If Not _isUpdating AndAlso (_cache Is Nothing OrElse _cache.Count = 0) Then
SyncLock _syncObj
If Not _isUpdating AndAlso (_cache Is Nothing OrElse _cache.Count = 0) Then
_isUpdating = True
Using msmq As New MessageQueue(CchToUserQueue)
msmq.Formatter = New XmlMessageFormatter(New Type() {GetType(NoticeDto)})
Dim cursor As Cursor = msmq.CreateCursor()
Dim message As Message = msmq.Peek(New TimeSpan(1), cursor, PeekAction.Current)
While message IsNot Nothing
Dim key = Guid.NewGuid().ToString()
_cache.Insert(key, message, Nothing, DateTime.UtcNow.AddSeconds(50), Cache.NoSlidingExpiration)
Try
message = msmq.Peek(New TimeSpan(0), cursor, PeekAction.Next)
Catch ex As MessageQueueException
' read to the end of the queue.
Exit While
End Try
End While
End Using
_isUpdating = False
End If
End SyncLock
End If
Return GetAllMessages()
End Get
End Property


第一个 If Not _isUpdating AndAlso (_cache Is Nothing OrElse _cache.Count = 0) Then
_cache.Count 是整数啊, 为什么还会报 exception 呢 ????
闻所未闻啊!!!!



...全文
62 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangchun1213 2012-04-13
  • 打赏
  • 举报
回复
这是C#代码么?

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧