哪些是最好的:第1号法典或第2号法典? 为什么?
/* Code Snippet 1
*
* Write try-catch in function definition
*/
void Main(string[] args)
{
AddMe();
}
void AddMe()
{
try
{
// Do operations...
}
catch(Exception e)
{
}
}
/* Code Snippet 2
*
* Write try-catch where we call the function.
*/
void Main(string[] args)
{
try
{
AddMe();
}
catch (Exception e)
{
}
}
void AddMe()
{
// Do operations...
}