Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

void keyword

Visto 7 veces
Saltar al primer mensaje no leído

Scott

no leída,
29 oct 2004, 15:00:0529/10/04
a
Can anyone please give me a broef explanation of what the void keyword is
for? What does it do? Do I need to use it?

Thanks,
Scott

Mattias Sjögren

no leída,
29 oct 2004, 15:10:3229/10/04
a

>Can anyone please give me a broef explanation of what the void keyword is
>for? What does it do? Do I need to use it?

The most common use is to have it as the return type of methods that
don't return a value.

void Foo()
{
// don't return anything
}

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Ansil MCAD

no leída,
29 oct 2004, 23:48:0629/10/04
a
hi
When used as the return type for a method, void specifies that the method
does not return a value.
void is not allowed in a method's parameter list. A method that takes no
parameters and returns no value is declared as follows:

void MyMethod();
{

}
regards
Ansil
anz...@gmail.com

Bob Grommes

no leída,
30 oct 2004, 22:34:4030/10/04
a
Many languages have a separate syntax for methods that return a value vs
those that don't. VB and VB.NET hav Sub vs Function, FoxPro has Procedure
vs Function, etc. C# just has a function syntax with a faux return type,
void, to indicate that nothing is to be returned. This is characteristic of
all C-family languages including Java and C++.

--Bob

"Scott" <Sc...@discussions.microsoft.com> wrote in message
news:11D5F97B-6BEE-4DB9...@microsoft.com...

0 mensajes nuevos