i have a question which is quite simple but yet complicated
for me
my question is why do we use void, if it does not return
anything to the compiler?
if it is used for normal display it can also be done by
what is called Console.Write() or Consol.WriteLine() and if
i do not use void with my method then my compiler throws me
an error. if i return a value say integer then i write
public int fun() display of the result can also be done
here
then why is it so necessary to use void with a function and
why so compiler throw us an error if v don't use void
return type?
Answer Posted / n r s reddy
Hi buddy...
its as simple as your questino.
By using key word VOID, just its an informationto the
comiler stating that following code is not goig to return
anything. Where we can save some resources like memory
etc... from functionality point of view.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What does the dispose method do with the connection object?
Define a manifest in .net?
How can you access a private method of a class?
Explain the types of assemblies in .net?
Distinguish between system.string and system.text.stringbuilder classes?
What is difference between private, protected, and public in C#?
Can you put two constructor with the same structure in a class?
What is dto c#?
what is a destructor?
What is Delegate and what is it used for ?
What are the steps for creating clr trigger
Why do we use abstraction in c#?
what is the difference between convert.tostring() and tostring() functions ?
What is transparent caching with aop ?
Why is it called c sharp?