PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5
You need to ensure that the service can send data in the following format to the client applications.

<Account Id= "" >
<Name></Name>
<Balance Currency= "" ></Balance>
</Account>

Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
[Serializable]
public class Account
{
[XmlAttribute] public string id;
[XmlElement] public string Name;
[XmlAttribute] public string Currency;
[XmlElement] public double Balance;
}

B.
[Datacontract]
public class Account
{
[DataMember(Order=0)] public string id;
[DataMember(Order=1)] public string Name;
[DataMember(Order=0)] public double Balance
[DataMember(Order=1)] public string Currency;
}

C.
[Serializable]
public class Account
{
[XmlAttribute] public string id;
public string Name;
[XmlElement("Balance")] public BalanceVal Balance;
}
[Serializable]
public class BalanceVal
{
[XmlText] public double Amount;
[XmlAttribute] public string Currency;
}

D.
[DataContract]
public class Account
{
[DataMember(Order=0)] public string id;
[DataMember(Order=1)] public string Name;
[DataMember(Name="Balance", Order=2)]
public BalanceVal Balance;
}
[DataContract]
public struct BalanceVal
{
[DataMember(Order=0)] public double Balance
[DataMember(Order=1)] public string Currency
}


Leave a Reply