:
1] ""
NULL. , :
Queue.Peek(TimeOut)
Queue.Receive(TimeOut)
Queue.ReceiveById(Id, TimeOut)
Queue.PeekById(Id, TimeOut)
...
2]
delegate Message MethodType1(Timeout)
delegate Message MethodType2(Id, TimeOut)
3] GetDelegate(),
object GetDelegate(ReadDecisions param)
{
switch(param)
{
case ReadNext:
MethodType1 receiveDlgt = new MethodType1(queue.Receive);
case PeekMessageId:
MethodType2 peekDlgt = new MethodType2(queue.Peek);
...
}
}
4]
InvokingMethod()
{
object methodToExecute = GetDelegate(ReadDecision)
if (methodToExecute.GetType() == typeof(MethodType1))
{
methodToExecute(TimeOut)
}
else
{
methodToExecute(Id, TimeOut)
}
}
, .
.