>
>dtShopOrder = new ERP().GetShopOrderDetails(txtSerialNum.Text);
>
>
>as opposed to
>
>
>ERP erp = new ERP();
>dtShopOrder = erp.GetShopOrderDetails(txtSerialNum.Text);
>
>
>Does one work better than the other? Any reasons to do it one way over the other?
>
>Personnally, I find syntax 2 easier to read.
Haven't tested this and could be completely wrong but I'd assume that the instance of ERP would potentially hang around longer using the second form (untill erp goes out of scope) - so if you know you won't need it again then use the first one.