Я просмотрел похожие вопросы и ответы, но я до сих пор не вижу проблемы в своем коде. У меня есть переключатель заявление и здесь:Невозможно поставить «по умолчанию» для переключения блока
switch (header)
{
case Headers.Queue:
{
int id = pr.ReadInt32();
string fileName = pr.ReadString();
long length = pr.ReadInt64();
TransferQueue queue = TransferQueue.CreateDownloadQueue(this, id, Path.Combine(downloadDirectory,
Path.GetFileName(fileName)), length);
_transfers.Add(id, queue);
if (Queued != null)
{
Queued(this, queue);
}
}
break;
case Headers.Start:
{
int id = pr.ReadInt32();
if (_transfers.ContainsKey(id))
{
_transfers[id].Start();
}
}
break;
case Headers.Chunk:
{
int id = pr.ReadInt32();
long index = pr.ReadInt64();
int size = pr.ReadInt32();
byte[] buffer = pr.ReadBytes(size);
TransferQueue queue = _transfers[id];
queue.Write(buffer, index);
queue.Progress = (int)((queue.Transferred * 100)/queue.Length);
if (queue.LastProgress < queue.Progress)
{
queue.LastProgress = queue.Progress;
if (ProgressChanged != null)
{
ProgressChanged(this, queue);
}
if (queue.Progress == 100)
{
queue.Close();
if (Complete != null)
{
Complete(this, queue);
}
}
}
}
break;
default:
{
}
}
Проблема заключается в том, блок по умолчанию выдает ошибку о том, что
Контроль не может провалиться из одного дела этикетке («по умолчанию:») к другое
Может ли кто-нибудь мне помочь?
Благодаря
посмотрим на то, как работает оператор переключатель http://msdn.microsoft.com/en-us/library/ 06tc147t (v = vs.90) .aspx – Ric
Добавить перерыв для инструкции по умолчанию – MKS
Да, глупая ошибка, спасибо – yrazlik