Hi friends
What is a void return type?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Blocked AccountRank #403 · 6.2K reputationPosted Nov 27, 2012, 1:01 AM EST
When used void as the return type for a method, void specifies that the method does not return a value.
Shankar MRank #874 · 2.5K reputationPosted Nov 27, 2012, 1:30 AM EST
Hi Rahul,
When void is used in method, it Specifies that the method that does not return a value.
Thanks,
Shankar
Shivanand ArurRank #920 · 2.3K reputationPosted Nov 27, 2012, 2:28 AM EST
1. Any data type from C#
2. Object/Collections/.... It can simply be anything.
3. Void - This is used if you feel that your program does not require to return anything, then in that case "void" is used....
Here's a small example :
using System
public class Mathematics
{
public static void Main(String[] args)
{
int value = Add(); // Integer value is returned by this method.
Console.WriteLine(value);
Multiply();
}
public int Add() // Returns an Integer
{
int x = 5 + 5;
return x;
}
public void Multiply() // Returns nothing
{
int y = 5 * 5;
Console.WriteLine(y);
}
}
So the Add method returns an integer where as the Multiply method returns nothing. In short my point here is that returning any value depends upon the logic of your program and the requirement.
Hope this helps u out.
And Please mark any of these answers as ACCEPTED if it helped you!!!
Always follow this rule of marking an answer as accepted or correct if it satisfies your need. This will help u and also others to get proper/correct answer.
Thank you,
Shivanand Arur.