/// <summary>
/// 我现在想得到
/// 输出结果:你妈的
/// 输出结果:已经接到异常
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
string s = "成功";
try
{
MyWrite(myt(s));
}
catch (Exception)
{ MyWrite((object)"已经接到异常");
}
}
public static string myt(string s)
{
try
{
Program.mytext();
}
catch (Exception ex)
{
s = ex.Message.ToString();
throw;
} return s;
} public static bool mytext()
{
throw new Exception("你妈的");
}
//输出函数
public static void MyWrite(object ob)
{
Console.WriteLine(ob);
}
/// 我现在想得到
/// 输出结果:你妈的
/// 输出结果:已经接到异常
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
string s = "成功";
try
{
MyWrite(myt(s));
}
catch (Exception)
{ MyWrite((object)"已经接到异常");
}
}
public static string myt(string s)
{
try
{
Program.mytext();
}
catch (Exception ex)
{
s = ex.Message.ToString();
throw;
} return s;
} public static bool mytext()
{
throw new Exception("你妈的");
}
//输出函数
public static void MyWrite(object ob)
{
Console.WriteLine(ob);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货