3
Answers

how to acces Enum in WCF service

Abbas Hamza

Abbas Hamza

11y
1.1k
1

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)