Question 12


Question

Multiple Choice

You are developing an applicaton by using C#. The applicaton includes the following code segment. (Line numbers are included for reference only.)

The DoWork() method must not throw any exceptons when convertng the obj object to the IDataContainer interface or when accessing the Data property.
You need to meet the requirements. Which code segment should you insert at line 07?

  • A. var dataContainer = (IDataContainer)obj)
  • B. dynamic dataContainer = obj)
  • C. dynamic dataContainer = obj)
  • D. var dataContainer = obj as IDataContainer)

Answer:

D