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.

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="ProjectBraindumps">
<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?

A. public class Role : ConfigurationElement {
    internal string_ElementName = “name”;
    [ConfigurationProperty("role")]
    public string Name {
    get {
    return ((string)base[“role”]);
    }
    }
    }
B. public class Role : ConfigurationElement {
    internal string_ElementName = “role”;
    [ConfigurationProperty("name", RequiredValue = true)]
    public string Name {
    get {
    return ((string)base[“name”]);
    }
    }
    }
C. public class Role : ConfigurationElement {
    internal string_ElementName = “role”;
    private String_name;
    [ConfigurationProperty("name")]
    public string Name {
    get {
    return_name;
    }
    }
    }
D. public class Role : ConfigurationElement {
    internal string_ElementName = “name”;
    private String_name;
    [ConfigurationProperty("role", RequiredValue = true)]
    public string Name {
    get {
    return_name;
    }
    }
    }



Answer: B
 

No comments:

Post a Comment