Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will contain an enumeration named OrderState. The OrderState enumeration will contain the following four values:

Processing
Cancelled
Confirmed
Closed

The client application must be able to set the state of an Order entity to only the following two values:

Cancelled
Closed

You need to create the data contract for OrderState. Which code segment should you use?

You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. The service will contain an enumeration named OrderState. The OrderState enumeration will contain the following four values:

Processing
Cancelled
Confirmed
Closed

The client application must be able to set the state of an Order entity to only the following two values:

Cancelled
Closed

You need to create the data contract for OrderState. Which code segment should you use?

A.
[DataContract]
public enum OrderState
{
Processing=1,
[DataMember]
Cancelled=2,
[DataMember]
Confirmed=3,
Closed=4
}

B.
[DataContract]
public enum OrderState
{
Processing=1,
[EnumMember]
Cancelled=2,
Confirmed=3,
[EnumMember]
Closed=4
}

C.
[DataContract]
public enum OrderState
{
[EnumMember(Value=”False”)]
Processing=1,
[EnumMember(Value=”True”)]
Cancelled=2,
[EnumMember(Value=”True”)]
Confirmed=3,
[EnumMember(Value=”False”)]
Closed=4
}

D.
[DataContract]
public enum OrderState
{
[DataMember]
Processing=1,
[DataMember(IsRequired=true)]
Cancelled=2,
[DataMember]
Confirmed=3,
[DataMember(IsRequired=true)]
Closed=4
}



Leave a Reply 0

Your email address will not be published. Required fields are marked *