المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : I can't get latest value by ref parameter. WHY?



C# Programming
05-12-2009, 07:32 PM
There are two layers in my project. one is business layer,and the other is UI layer.
In UI layer, i invoke the method 'SaveInfo' of business layer. by the way ServiceActivator.GetService.

But i can't get 'newInfo' in UI layer.
and if i remove 'throw ex;' in 'SaveInfo' method. i could get it.
i don't know why.
do you know? how could i get newInfo if i want to throw Exception to UI layer.
pls. ths.

'SaveInfo' in Business layer:
public void SaveInfo(ref StudentInfo info,ref List detailList,string strType)
{
try
{
...
info = newInfo;
detailList = newDetailList;
throw new MyException("?????");
...
}
catch(Exception ex)
{
throw ex;
}
}

the invoke code in UI layer:

try
{
...
mMyDs.SaveInfo(ref curInfo,ref curList,"Add");
...
]
catch(MyException mex)
{
textBox1.text = curInfo.Name;
}
catch(Exception ex)
{
}

MSN:msnadair@hotmail.com
Skype:skyadair