Using enumeration for SVC service in C#

It takes me a whole day to try this...

Using SVC service as web service and passing enumeration data type needs:  [DataContract], [EnumMember] and [ServiceKnownType(typeof(MyEnum))]

ex.
 [DataContract]  
   public enum ResultCode  
   {  
     [EnumMember]  
     Success = 200,  
     [EnumMember]  
     System_Error = 500  
   }  
 [OperationContract]  
 [ServiceKnownType(typeof(ResultCode))]  
 ActionResult<ResultCode> Process();  

留言

這個網誌中的熱門文章

使用Mac的Preview來合併兩張圖片

重拾起書本

Mac OS X 10.6.3 上的黑體-繁