dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]OT?: silly C# questions


From: Rhys Weatherley
Subject: Re: [DotGNU]OT?: silly C# questions
Date: Sun, 03 Mar 2002 10:00:55 +1000

S11001001 wrote:

> 1. How do you declare package visibility on a method/constructor? (probably
> something ridiculous like the keyword `package')

There's no such thing as "package visibility" in C#,
but there is "assembly visibility", which limits the
definition to the DLL in which it resides.  The keyword
is "internal".  "protected internal" can be used to
restrict things further so that only subclasses in
the same assembly can see the definition.

> 2. I know every decent language allows switch/case statements to fall through
> (thus the ubiquitous break;), but I remember reading recently about some
> language that didn't want you to do it, and I forget which one. Anyway, I do
> remember C# switch statements having a couple pages devoted to them, so any
> behavioural enlightenment would be appreciated.

C# cases do NOT fall through, and the compiler will give
an error if the case doesn't end with some kind of jump
instruction (usually "break").  If you need to fall through,
then use "goto case N", where "N" is the label on the
next case.  "goto default" is used when the next case
is the default case.

Yes, it's stupid, but it's too late to change it now. :-(

Cheers,

Rhys.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]