Sunday 3 July 2016

.NET Basics - What does void mean in C#? Is it the same meaning as in C++ or Java?

The void keyword means pretty much the same thing in C# as it means in Java or C++.  But there are few things to be aware of.

  • void used as a method return type means that the method does not return a value. (Implementation-wise it is an alias for System.Void in mscorlib - which has no members except what it inherits from System.Object)
  • void is also used to declare a pointer to an unknown type, when used in an unsafe context

No comments: