Download
100% FREE
Office Document APIs for .NET
Online: 1095
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Bookmarks
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Forums
>
Interview Questions
>
Loading ...
Return the value when returntype is void
Posted by
Mahesh_Chs
under
Interview Questions
on 1/25/2013 |
Points: 10
| Views : 1044 | Status :
[Member]
| Replies : 4
Write New Post
|
Search Forums
|
Resolved Posts
|
Un Answered Posts
|
Forums Home
hii
Is there any chance to return the value, when the return type is void. If yes how ?
Thanks & Regards
Mahesh Chayanam
Reply
|
Reply with Attachment
Alert Moderator
Responses
Posted by:
Ankur56600
on: 1/26/2013
[Member]
Starter
|
Points: 25
0
no there is no chance to return a value when return type is void because void keyword tells the compiler that the function should not return any value ...
Mahesh_Chs
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Sheonarayan
on: 1/26/2013
[Administrator]
HonoraryPlatinum
|
Points: 25
0
You may pass an output parameter to the method and set the value inside the method and use it. More on output parameter here
http://www.dotnetfunda.com/articles/article1526-csharp-out-parameter-explored.aspx
Alternatively, you can use the parameter by ref, see the thread here that discuss about it
http://www.dotnetfunda.com/forums/thread3303-difference-between-ref-and-out-parameters-in-csharp.aspx
.
Hope this helps.
Thanks
Regards,
Sheo Narayan
http://www.dotnetfunda.com
Mahesh_Chs
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Toabhishek13
on: 1/31/2013
[Member]
Starter
|
Points: 25
0
Not possible as code will not compile.
Thanks
Abhishek
Mahesh_Chs
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Kundan64
on: 1/31/2013
[Member]
Starter
|
Points: 25
0
You can use Parameter in the 'void' method as 'ref' and 'out', it will return the value in the Parameter, but void method can not return any value.
Mahesh_Chs
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Login to post response
Latest Posts
SEO(Search Engine Optimization)
(0)
New
Dial Hotmail Customer service Number +1-800-518-0963
(0)
New
Best Assignment Help Services Provider
(0)
Updated
How can a video in the website explain the navbar values?
(1)
Updated
surge arresters price
(0)
New
small hot chamber die casting machine for sale
(0)
New
Hangzhou Lin'an Tianfu non-woven
(0)
New
low price hook and loop buckle strap
(0)
New
More ...