Abbas Hamza

Abbas Hamza

  • NA
  • 100
  • 52.9k

how to acces Enum in WCF service

Oct 28 2013 12:59 PM

Hi i have created a WCF service which include enum as follow

[
DataContract]
public class Status
{
[
DataMember]
public EServiceCallStatus ServiceMessageStatus;
}
[
DataContract(Name="ServiceStatus")]
public enum EServiceCallStatus
{
[
EnumMember]
Pending,
[
EnumMember]
Success,
[
EnumMember]
Failure
}
and in my Iservice i have done as follow

[
OperationContract]
Status GetStatus();
and in my Service.cs i have done the following and that is where my question is coming

///
<summary>
/// Set the service message status
/// </summary>
/// <returns>return the service message</returns>
public Status GetStatus()
{
Status es = new Status();
es.ServiceMessageStatus =
EServiceCallStatus.Success;
return es;
//throw new NotImplementedException();
}
how can i when i created new instance of my service in a client to be able to say :
if myserviceWCF.ServiceMessageStatus =
EServiceCallStatus.Success then //do something
could you please help in solving this issue
regards

Answers (3)