What will happen,when we compile below C# code?
private void sum(int a,int b)
{
return a + b;
}

 Posted by vishalneeraj-24503 on 10/8/2014 | Category: C# Interview questions | Views: 2692 | Points: 40
Answer:

It will give below compile-time error as:-
Since '_Default.sum()' returns void, a return keyword must not be followed by an object expression.
Means if the return type is void,then we need not return any value from code as void returns Nothing.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response