[Mono-list] Helo in switch-case:
John Barnette
jbarn@httcb.net
Sat, 16 Mar 2002 00:29:47 -0700
At 11:05 PM 3/15/2002, Gaurav Vaish wrote:
>Error:
>
>
>d:\Temp\mcs\class\System.Web\System.Web.UI.WebControls\TemplateColumn.cs(87,4):
>error CS0163: Control cannot fall through from one case label ('default:') to
>another
>
>Line of error:
> switch(itemType)
>
>Code:
>--------------------------
> public override void InitializeCell(TableCell cell, int columnIndex,
>ListItemType itemType)
> {
> base.InitializeCell(cell, columnIndex, itemType);
> ITemplate toRender = null;
> switch(itemType) // **** This is where the error is pointed
> *****
> {
> case ListItemType.Header: toRender = headerTemplate;
> break;
> case ListItemType.Footer: toRender = footerTemplate;
> break;
> case ListItemType.Item: toRender = itemTemplate;
> break;
> case ListItemType.AlternatingItem: toRender = itemTemplate;
> break;
> case ListItemType.SelectedItem: toRender = editItemTemplate;
> break;
> default: toRender = editItemTemplate;
> }
> if(toRender != null)
> {
> cell.Text = String.Empty;
> toRender.InstantiateIn(cell);
> }
> }
Gaurav,
Even default: labels must have a break in C#, I believe.
~ j.