Question:
You are creating an application that retrieves values from a custom section of the application configuration file. The custom section uses XML as shown in the following block.
<ProjectSection name="Project1">
<role name="administrator" />
<role name="manager" />
<role name="support" />
</ProjectSection>
You need to write a code segment to define a class named Role. You need to ensure that the Role class is initialized with values that are retrieved from the custom section of the configuration file.
Which code segment should you use?
Inherits ConfigurationElement
Friend _ElementName As String = "role"
Private _name As String
<ConfigurationProperty("name")>_
Public ReadOnly Property Name() As String
Get
Return _name
End Get
End Property
End Class
B
Inherits ConfigurationElement
Friend _ElementName As String = "name"
Private _name As String
<ConfigurationProperty("role", IsRequired:=True)> _
Public ReadOnly Property Name() As String Get
Return _name
End Get
End Property
End Class
C
Inherits ConfigurationElement
Friend _ElementName As String = "role"
<ConfigurationProperty("name", IsRequired:=True)>_
Public ReadOnly Property Name() As String Get
Return CType(Me("name"), String)
End Get
End Property
End Class
D
"A Composite Solution With Just One Click" - Certification Guaranteed 265 Microsoft 70-536 Exam
Inherits ConfigurationElement
Friend _ElementName As String = "name"
<ConfigurationProperty("role")>_
Public ReadOnly Property Name() As String
Get
Return CType(Me("role"), String)
End Get
End Property
End Class