c# returning object created in function
<p>I have a function as follows.</p>

<pre><code>    public StartEnd ConvertStartEnd(StartEnd pse, Item pi)
    {
        if (DaysBefore == pi.DaysBefore &amp;&amp; DaysAfter == pi.DaysAfter)
        {
            return pse;
        }
        StartEnd ise = new StartEnd();
        if (pse.Start &lt;= DaysBefore)
        {
            int var1 = DaysBefore - pse.Start;
            int var2 = pi.DaysBefore - var1;
            if (var2 &lt; 0)
            {
                ise.Start = -1;
            }
            else
            {
                ise.Start = var2;
            }
        }
        else if (pse.Start &gt; DaysBefore)
        {
            int var1 = pse.Start - DaysBefore;
            if (var1 &gt; DaysAfter)
            {
                ise.Start = -1;
            }
            else
            {
                ise.Start = pi.DaysBefore + var1;
            }
        }

        if (pse.End &lt;= DaysBefore)
        {
            int var1 = DaysBefore - pse.End;
            int var2 = pi.DaysBefore - var1;
            if (var2 &lt; 0)
            {
                ise.End = -1;
            }
            else
            {
                ise.End = var2;
            }
        }
        else if (pse.End &gt; DaysBefore)
        {
            int var1 = pse.End - DaysBefore;
            if (var1 &gt; DaysAfter)
            {
                ise.End = -1;
            }
            else
            {
                ise.End = pi.DaysBefore + var1;
            }
        }
        return ise;
    }
</code></pre>

<p>which is essentially creating an object in the function and returning it.</p>

<p>When I say, <code>var insSe = ConvertStartEnd(portSe, entry.Value);</code>, I get no return value. I've debugged the function and an object exists at the line where the <code>return</code> statement exists. But when I return to the calling function there's nothing. What is going wrong?</p>
