本文整理汇总了C#中IComparable.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# IComparable.GetHashCode方法的具体用法?C# IComparable.GetHashCode怎么用?C# IComparable.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IComparable
的用法示例。
在下文中一共展示了IComparable.GetHashCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteWorkflowQueue
public void DeleteWorkflowQueue(IComparable queueName)
{
if (queueName == null)
throw new ArgumentNullException("queueName");
lock (SyncRoot)
{
// when we are deleting the queue from activity
// message delivery should not happen.
if (this.rootQueuingService != null && !IsTransactionalQueue(queueName))
{
this.rootQueuingService.DeleteWorkflowQueue(queueName);
return;
}
EventQueueState queueState = GetEventQueueState(queueName);
Queue queue = queueState.Messages;
Queue pendingQueue = this.pendingQueueState.Messages;
while (queue.Count != 0)
{
pendingQueue.Enqueue(queue.Dequeue());
}
WorkflowTrace.Runtime.TraceInformation("Queuing Service: Deleting Queue with ID {0} for {1}", queueName.GetHashCode(), queueName);
this.persistedQueueStates.Remove(queueName);
}
}
示例2: NewQueue
private void NewQueue(IComparable queueID, bool enabled, bool transactional)
{
WorkflowTrace.Runtime.TraceInformation("Queuing Service: Creating new Queue with ID {0} for {1}", queueID.GetHashCode(), queueID);
if (this.persistedQueueStates.ContainsKey(queueID))
{
object[] args =
new object[] { System.Messaging.MessageQueueErrorCode.QueueExists, queueID };
string message =
string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.EventQueueException, args);
throw new QueueException(message, MessageQueueErrorCode.QueueExists);
}
EventQueueState queueState = new EventQueueState();
queueState.Enabled = enabled;
queueState.queueName = queueID;
queueState.Transactional = transactional;
this.persistedQueueStates.Add(queueID, queueState);
}
示例3: SafeEnqueueEvent
internal bool SafeEnqueueEvent(IComparable queueName, object item)
{
if (queueName == null)
{
throw new ArgumentNullException("queueName");
}
lock (this.SyncRoot)
{
if ((this.rootQueuingService != null) && !this.IsTransactionalQueue(queueName))
{
return this.rootQueuingService.SafeEnqueueEvent(queueName, item);
}
EventQueueState queue = this.GetQueue(queueName);
if (!queue.Enabled)
{
throw new QueueException(string.Format(CultureInfo.CurrentCulture, ExecutionStringManager.QueueNotEnabled, new object[] { queueName }), MessageQueueErrorCode.QueueNotAvailable);
}
queue.Messages.Enqueue(item);
WorkflowTrace.Runtime.TraceInformation("Queuing Service: Enqueue item Queue ID {0} for {1}", new object[] { queueName.GetHashCode(), queueName });
for (int i = 0; (this.messageArrivalEventHandlers != null) && (i < this.messageArrivalEventHandlers.Count); i++)
{
this.messageArrivalEventHandlers[i].OnItemSafeEnqueued(queueName, item);
}
this.NotifySynchronousSubscribers(queueName, queue, item);
return this.QueueAsynchronousEvent(queueName, queue);
}
}
示例4: SafeEnqueueEvent
internal bool SafeEnqueueEvent(IComparable queueName, Object item)
{
if (queueName == null)
throw new ArgumentNullException("queueName");
lock (SyncRoot)
{
if (this.rootQueuingService != null && !IsTransactionalQueue(queueName))
{
return this.rootQueuingService.SafeEnqueueEvent(queueName, item);
}
EventQueueState qState = GetQueue(queueName);
if (!qState.Enabled)
{
throw new QueueException(String.Format(CultureInfo.CurrentCulture, ExecutionStringManager.QueueNotEnabled, queueName), MessageQueueErrorCode.QueueNotAvailable);
}
// note enqueue allowed irrespective of dirty flag since it is delivered through
qState.Messages.Enqueue(item);
WorkflowTrace.Runtime.TraceInformation("Queuing Service: Enqueue item Queue ID {0} for {1}", queueName.GetHashCode(), queueName);
// notify message arrived subscribers
for (int i = 0; messageArrivalEventHandlers != null && i < messageArrivalEventHandlers.Count; ++i)
{
this.messageArrivalEventHandlers[i].OnItemSafeEnqueued(queueName, item);
}
NotifySynchronousSubscribers(queueName, qState, item);
return QueueAsynchronousEvent(queueName, qState);
}
}
示例5: DeleteWorkflowQueue
public void DeleteWorkflowQueue(IComparable queueName)
{
if (queueName == null)
{
throw new ArgumentNullException("queueName");
}
lock (this.SyncRoot)
{
if ((this.rootQueuingService != null) && !this.IsTransactionalQueue(queueName))
{
this.rootQueuingService.DeleteWorkflowQueue(queueName);
}
else
{
Queue messages = this.GetEventQueueState(queueName).Messages;
Queue queue2 = this.pendingQueueState.Messages;
while (messages.Count != 0)
{
queue2.Enqueue(messages.Dequeue());
}
WorkflowTrace.Runtime.TraceInformation("Queuing Service: Deleting Queue with ID {0} for {1}", new object[] { queueName.GetHashCode(), queueName });
this.persistedQueueStates.Remove(queueName);
}
}
}