In both cases, Dispose will probably happen at the same time - unless the definition of
objMortgageBAL
is at class level. If it is a local variable, then it will go out of scope at the end of the method, and is available for disposal at that point. That doesn't mean it will be Disposed, however!
Unless Dispose is explicitly (or implitly via a
using
block) called, reference items will not be disposed until the Garbage Collector runs out of space and decides that the object is no longer referenced.
If you want to control Disposal, then good practice would be:
using (objMortgageBAL = new MortgageBAL())
{
int Result = objMortgageBAL.SaveLegalTeamComments(CauseNo, DefendantID);
...
}
In which case the MortgageBAL object will be disposed when it goes out of scope at the closing curly bracket.