110,537
社区成员
发帖
与我相关
我的任务
分享
class MyException : Exception
{
private Dictionary<int, string> m_data = new Dictionary<int, string>();
private int index=0;
public int MyIndex
{
set
{
index = value;
}
}
public MyException()
{
m_data.Add(-1, "true");
m_data.Add(1, "找不到指定item");
}
public override string Message
{
get
{
switch (index)
{
case 0: break;
default: return m_data[index];
}
return base.Message;
}
}
}
try
{
File.Create(.....
}
catch(FileNotFoundException ex)
{
throw new MyExceltion{MyIndex=123456789};
}
public class aaa : Exception
{
public aaa(string message, Exception e) : base(message, e) { }
public int MyIndex{get;set;}
}