Abnormal state of confusion
Some people call it Super exception. Refers not catch the exception, disrupting the process of the state, cause crashes, or do not want to see the process leading to behavior, like insanity. CLR4.0 not catch the exception made for a configurable processing mechanism. Consider the following procedure. In CLR2.0 years, this catch (Exception ex) of all possible exceptions are caught. In CLR4.0 where, by default, will not take effect this super catch, if abnormal will cause the program to stop.
class Program
(
static void Main (string [] args)
(
SaveFile ("file.txt");
Console.ReadLine ();
)
public static void SaveFile (string fileName)
(
try
(
FileStream fs = new FileStream (fileName, FileMode.Create);
)
catch (Exception ex)
(
Console.WriteLine ("File open error");
throw new IOException ();
)
)
)
Because of some special circumstances, need to change the default strategy. CLR 4.0 provides two means of customized
[HandleProcessCorruptedStateExceptions] method of labeling (Method attribute)
Methods need a super catch by adding the label. Take effect can make a super catch, as follows:
[HandleProcessCorruptedStateExceptions]
public static void SaveFile (string fileName)
(
try
(
FileStream fs = new FileStream (fileName, FileMode.Create);
)
catch (Exception ex)
(
Console.WriteLine ("File open error");
throw new IOException ();
)
)
Note: This form can only take effect within this method. In other places, or the default by CLR4.0 manner. config configuration file if you want to change this policy throughout the application level, the configuration file in config write
Recommended links:
Cursors And Fonts Introduction
Guide to fully experience the Still-mail (a) - attachment
"NBA 2K10" career mode performance of a PERSONAL experience A +
10 Days Of The First Day Of The Institute Of ASP.net
dvd drive can not write To writable discs windows
Pole through the "Swiss Friends of the lawsuit against Tao case" statement to the Public
Clocks And ALARMS Storage
DV to AVI
Zhongguancun hand new countryside
DivX to MPEG
Wave Of Mergers BI Have A Happy Life
Sony BMG U.S. Federal Court approved a settlement agreement with the consumer
AVI to DivX
No comments:
Post a Comment