Skip to main content
Published: April 11 2007, 12:24:00 PMUpdated: November 28 2020, 3:36:06 PM

How can I get the values for an enumeration if I am using SOAP or the .NET SDK ?


Summary

With .NET, you can make use of the Enum class and use the method GetNames to get the array of the names of the constants in a specified enumeration. 


Detailed Description

Here is a C# example that retrieves the list of HitCounter values:
 
using System;
using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;

namespace SDKSamples
{

public class SDKSamples
{
public void GetEnumValues()
{
    string[] counters = Enum.GetNames(typeof(HitCounterCodeType));
    //iterate over the array
   
for (int i =0; i < counters.Length; i++)
   {
       //iterate over the array and access the value using counters[i]
   }
 
}

}

}



Version Info

The code example above was based on the versions specified below:

API Schema Version 495
.NET SDK Version .NET SDK v495.0 full release


 

How well did this answer your question?
Answers others found helpful