110,534
社区成员
发帖
与我相关
我的任务
分享
static string testtryfinal()
{
string result = "";
try
{
result = "A";
if (result == "A")
throw new Exception();
}
catch {
result = "C";
}
finally
{
result = "B";
Console.WriteLine("FINAL");
}
return result;
}
static string testtryfinal()
{
string result = "";
try
{
result = "A";
if (result != "A")
throw new Exception();
return result;
}
catch {
result = "C";
return result;
}
finally
{
result = "B";
Console.WriteLine("FINAL");
}
}
class Program
{
public static void Main(string[] args)
{
// TODO: Implement Functionality Here
TT b=new TT(){ T1=""};
testtryfinal(b);
Console.Write(b.T1);
Console.ReadKey(true);
}
static TT testtryfinal(TT result)
{
result.T1=string.Empty;
try
{
result.T1 = "A";
if (result.ToString() != "A")
throw new Exception();
return result;
}
catch {
result.T1 = "C";
return result;
}
finally
{
result.T1 = "B";
Console.WriteLine("FINAL");
}
}
}
class TT{
public object T1{get;set;}
}