Skip to main content
Published: April 11 2007, 12:24:00 PMUpdated: August 02 2022, 2:43:28 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]
   }
 
}

}

}

 


 

 

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

Got thoughts? Click the feedback button – your insights help us improve!