2009-04-19 70 views
0

是否可以安全使用静态异常实例?有什么理由避免以下情况?静态异常实例

public class ResourceHttpHandler : IHttpHandler 
{ 
    private static HttpException notFoundException = 
       new HttpException(
        (int)HttpStatusCode.NotFound, 
        "Assembly Not Found"); 

    public bool IsReusable 
    { 
     get { return true; } 
    } 

    public void ProcessRequest(HttpContext context) 
    { 
     .... 
     throw notFoundException; 
     .... 
    } 
} 

回答