Home All Groups Group Topic Archive Search About
Author
28 Nov 2007 6:37 PM
Tony Johansson
Hello!

When I define a class the default  access modifier is internal.

So if I just write
class MyTest
{
. . .
}
this definition has internal as access modifier

but if I define a delegate as
delegete returnType SomeName (someArgumentList);
Is it the same here that internal is the default access modifier if none is
given

//Tony

Author
28 Nov 2007 6:46 PM
Nicholas Paldino [.NET/C# MVP]
Tony,

    Yes, that is the case.


--
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard.caspershouse.com

Show quote
"Tony Johansson" <johansson.anders***@telia.com> wrote in message
news:Fzi3j.956$R_4.712@newsb.telia.net...
> Hello!
>
> When I define a class the default  access modifier is internal.
>
> So if I just write
> class MyTest
> {
> . . .
> }
> this definition has internal as access modifier
>
> but if I define a delegate as
> delegete returnType SomeName (someArgumentList);
> Is it the same here that internal is the default access modifier if none
> is given
>
> //Tony
>
Author
28 Nov 2007 7:23 PM
Jon Skeet [C# MVP]
Tony Johansson <johansson.anders***@telia.com> wrote:
> this definition has internal as access modifier
>
> but if I define a delegate as
> delegete returnType SomeName (someArgumentList);
> Is it the same here that internal is the default access modifier if none is
> given

If it's declared outside another type, that's true.
If it's declared within another type, it's private by default. (The
same is true for other types too.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Author
28 Nov 2007 9:13 PM
Tony Johansson
Hello!

When I write this delegete returnType SomeName (someArgumentList);
I call it to define a delegate but you call it to declare.
In C++ it was a big difference between define a class and to declare a
class.

In my exemple here with the delegate I assume you agree with me
that to define and declare is the same.

It's just a matter of taste.

//Tony

Show quote
"Jon Skeet [C# MVP]" <sk***@pobox.com> skrev i meddelandet
news:MPG.21b7d07f1caef6a677@msnews.microsoft.com...
> Tony Johansson <johansson.anders***@telia.com> wrote:
>> this definition has internal as access modifier
>>
>> but if I define a delegate as
>> delegete returnType SomeName (someArgumentList);
>> Is it the same here that internal is the default access modifier if none
>> is
>> given
>
> If it's declared outside another type, that's true.
> If it's declared within another type, it's private by default. (The
> same is true for other types too.)
>
> --
> Jon Skeet - <sk***@pobox.com>
> http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
> World class .NET training in the UK: http://iterativetraining.co.uk
Author
29 Nov 2007 12:00 AM
Jon Skeet [C# MVP]
Tony Johansson <johansson.anders***@telia.com> wrote:
> When I write this delegete returnType SomeName (someArgumentList);
> I call it to define a delegate but you call it to declare.

Well, it's declaring a delegate type.

> In C++ it was a big difference between define a class and to declare a
> class.
>
> In my exemple here with the delegate I assume you agree with me
> that to define and declare is the same.

Well, it depends what you use "declare" and "define" to mean. I tend to
use "declaration" because that's what the spec does. For instance:

"A delegate-declaration is a type-declaration (§9.6) that declares a
new delegate type."

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

AddThis Social Bookmark Button