I have a web service called test_WebService
. In that web service I have the following reference:
public enum getAttributeData : int
{
[System.Runtime.Serialization.EnumMemberAttribute()]
DataFile = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
DataType = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
DataSource = 2,
}
The following method is in the web service:
GetDataFromService(getAttributeData *entity*)
I have the following code:
client_Service newSevice = new client_Service();
getAttributeData AD = 2;
String result = GetDataFromService(AD);
Console.WriteLine(result.ToString());
I am getting the error:
Cannot implicitly convert type int to 'getAttributeData;. An explicit conversion exists (are you missing a cast?)
您必须强制枚举:
getAttributeData AD = (getAttributeData) 2;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.