some c#

  • Thread starter Thread starter Ivan Simurina
  • Start date Start date
I

Ivan Simurina

Hi

I would appreciate being clarified simple peace of code,


protected void ShowDailyEvents()
{
DateTime d = MyCalendar.SelectedDate;
DataSet dataSet = LoadMyCalendarData();
if (dataSet == null)
{
return;
}

more code... bla bla
}

I dont understand whats the role of "return" here.
There should be some work on the dataset, but theres just "return",
does this just skip the if structure and continues to the rest of the code
in the method or something else?

thanx
 
Ivan Simurina said:
Hi

I would appreciate being clarified simple peace of code,


protected void ShowDailyEvents()
{
DateTime d = MyCalendar.SelectedDate;
DataSet dataSet = LoadMyCalendarData();
if (dataSet == null)
{
return;
}

more code... bla bla
}

I dont understand whats the role of "return" here.
There should be some work on the dataset, but theres just "return",
does this just skip the if structure and continues to the rest of the code
in the method or something else?
No, it ends the method.

I would assume that that snippet jumps out of hte method because dataSet is
null and cannot be processed.
 
Back
Top