PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are localizing a Windows Forms application. You put all error message strings into a resource file named ErrorMessage file. When the resource file is compiled, a strongly typed resource class is generated.
You need to retrieve an error message named CatastrophicErr from the exception-handling code.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
string s= ErrorMessages. CatastrophicErr;

B.
string s= Properties.Settings.Default["ErrorMessages_CatastrophicErr"].ToString();

C.
StringInfo si = new StringInfo("ErrorMessages. CatastrophicErr");
string s = si.String;

D.
Assembly a = Assembly.GetExecutingAssembly();
Stream stream = a.GetManifestRseourceStream("ErrorMessage.CatastrophicErr");
StreamReader sr= new StreamReader(stream);
stream s= sr.ReadToEnd();


Leave a Reply