class Program
{
static void Main(string[] args)
{
Program t = new Program();
int y = t.aaa();
List<string> list = t.GetList();
Console.ReadLine();
}
public int aaa()
{
int x = 1;
try
{
return ++x;
}
catch (Exception e)
{
}
finally
{
++x;
}
return x;
}
public List<string> GetList()
{
var list = new List<string>() { "aaa" };
try
{
list.Add("bbb");
return list;
}
catch (Exception)
{
}
finally
{
list.Add("ccc");
}
return list;
}
}
如果按照原作者的邏輯,GetList()這個方法返回的應該是包含“aaa”,“bbb”兩個字符串的list,但是結果卻返回了“aaa”“bbb”“ccc”三個數據的list,而且最變態的是,如果我將這個方法改為返回list.Count,返回的結果是2,希望大神能幫我解釋一下原因?