日期:2014-05-18 浏览次数:20935 次
static public int AppendOneFileToAnother()
{
StreamWriter sw = null;
StreamReader sr = null;
string tempLineStr = string.Empty;
try
{
return 1;
}
catch (Exception ex)
{
Console.Write("AppendFileErro :" + ex.Message);
logger.Error("AppendFileErro :" + ex.Message);
throw ex;
}
finally
{
sw.Close();
sr.Close();
}
}
static int Main(string[] args)
{
try
{
return 1;
}
catch (Exception ex)
{
Console.Write("AppendFileErro :" + ex.Message);
logger.Error("AppendFileErro :" + ex.Message);
throw ex;
}
finally
{
}
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static public int AppendOneFileToAnother()
{
try
{
return 1;
}
catch (Exception ex)
{
Console.Write("AppendFileErro :" + ex.Message);
throw ex;
}
finally
{
}
}
static int Main(string[] args)
{
try
{
return 1;
}
catch (Exception ex)
{
Console.Write("AppendFileErro :" + ex.Message);
throw ex;
}
finally
{
}
}
}
}
------解决方案--------------------
没报错 `
------解决方案--------------------
回复内容太短了!。。。
我也想知道原因
------解决方案--------------------
static public int AppendOneFileToAnother()
{
StreamWriter sw = null;
int returnNumber=0;
StreamReader sr = null;
string tempLineStr = string.Empty;
try
{
//todo
}
catch (Exception ex)
{
returnNumber=-1;
Console.Write("AppendFileErro :" + ex.Message);
logger.Error("AppendFileErro :" + ex.Message);
throw ex;
}
finally
{
sw.Close();
sr.Close();
}
return returnNumber;
}
最好不要那么写。没有意义的话。
虽然没什么错。
我靠