You are developing an ASP.NET MVC application in Visual Studio. The application supports multiple cultures.
The application contains three resource files in the Resources directory:
MyDictionary.resx
MyDictionary.es.resx
MyDictionary.fr.resx
Each file contains a public resource named Title with localized translation.
The application is configured to set the culture based on the client browser settings.
The application contains a controller with the action defined in the following code segment. (Line numbers are
included for reference only.)
You need to set ViewBag.Title to the localized title contained in the resource files.
Which code segment should you add to the action at line 03?
A.
ViewBag.Title = HttpContext.GetGlobalResourceObject(“MyDictionary”, “Title”);
B.
ViewBag.Title = HttpContext.GetGlobalResourceObject(“MyDictionary”, “Title”,new
System.Globalization.CultureInfo(“en”));
C.
ViewBag.Title = Resources.MyDictionary.Title;
D.
ViewBag.Title = HttpContext.GetLocalResourceObject(“MyDictionary”, “Title”);
Explanation:
Only the Resources class is used.