0

what is the difference between void & other data type irrespective by using in a creation of Methods because my basic knowledge are not clear that's why I ask this kind of question I can't understand that when to use void and when other datatypes ?

1 Answers1

-1

void simply means nothing. See the MSDN:

When used as the return type for a method, void specifies that the method doesn't return a value. void isn't allowed in the parameter list of a method. A method that takes no parameters and returns no value is declared as follows:

public void SampleMethod()
{
    // Body of the method.
}

void is also used in an unsafe context to declare a pointer to an unknown type.

For more information, see Pointer types (C# Programming Guide).

void is an alias for the .NET Framework System.Void type.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • Void return nothing.... like lets say.. if i want to assign a value to different text box which is not involved in any process. Then i will use void... – Abhijeet Bagul May 04 '16 at 09:08