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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top