Search code examples
c#loopssqldbtype

How can i iterate through all System.Data.SqlDbType s?


As my questeion above i would like to iterate through ALL System.Data.SqlDbTypes. How is this possible?

I'm thinking about something like this:

foreach (var type in System.Data.SqlDbType(s))
{
   ..code         
}

I know System.Data.SqlDbType is no List or IEnumerable :)


Solution

  • You may try this:

    foreach (SqlDbType type in Enum.GetValues(typeof(SqlDbType)))
    {
       ..code
    }