0

Hey guys, I was wondering if anyone can tell me if VOID in C# is a keyword? If so is it built in or library type? I cant seem to find decent information on this. Also I was wondering about ArrayList, which kind of type this is?

Any advice on this would be appreciated, many thanks!

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by deucalion0
1

void means a function (either) does not return a result or take parameters
...depending on where it's placed

//Takes a string; returns nothing
public static void DoSomething(string strData)
{
//...code goes here
   return; //optional
}

//returns a string; takes no parameters
public static string DoSomething(/*implied void*/)
{
//...code goes here
   return "some string"; //mandatory
}

In languages like Pascal and Visual Basic, functions that do not return values even have different names (other than function).
Pascal = Procedure
VB = Sub

Edited by thines01: n/a

0

If you are more used to Pascal type programing languages you could speak of procedures or subroutines. Meaning functionality done without returning a value. A function normally always returns a value. So in C-like languages void is used to handle this.

ArrayList is a list of any object you like.
This can be handy in certain circonstances, but it is not type save.
Better is to use the List<T> type.

0

Thanks for your help and advice on this guys, it is appreciated. I think I know how to proceed now!

Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.