PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating an XML Web service that will consist of a class named Stock. Stock will expose the following public fields: Symbol, CompanyName, and CurrentPrice.

When serialized by the XMLSerializer, Stock will take the following form:

<Stock symbol=”>
<Company />
<CurrentPrice />
</Stock>

You need to construct the Stock class.

Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
public class Stock {
[XmlElementAttribute(“symbol”)]
public string Symbol;
[XmlElementAttribute()]
public string CompanyName;
public string CurrentPrice;
}

B.
public class Stock {
public string Symbol;
[XmlElementAttribute(“Company”)]
public string CompanyName;
public string CurrentPrice;
}

C.
public class Stock {
[XmlAttributeAttribute(“symbol”)]
public string Symbol;
[XmlElementAttribute(“Company”)]
public string CompanyName;
public string CurrentPrice;
}

D.
public class Stock {
[XmlAttributeAttribute()]
public string Symbol;
[XmlElementAttribute()]
public string CompanyName;
[XmlElementAttribute()]
public string CurrentPrice;
}


Leave a Reply