How to check if a variable is an IEnumerable of some sort

You have already accepted an answer however,since generic IEnumerable<T> implements the non generic IEnumerable you can just cast to that.

// Does write handle null? Might need some sanity aswell.

var enumerable = variable as System.Collections.IEnumerable; 

if (enumerable != null)
    foreach(var item in enumerable)
         Write(item);
else
    Write(item);     

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)