Is there a better way?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is there a better way?

Slide-2
Is there a better way to get an enumerator from an object passed in to
a C# implemented module?

IEnumerator e = null;
if (sequence is IEnumerator)
    e = sequence as IEnumerator;
else if (sequence is IEnumerable)
    e = ((IEnumerable)sequence).GetEnumerator();

if (e == null)
    throw PythonOps.TypeError("writerows() argument must be iterable");



--
slide-o-blog
http://slide-o-blog.blogspot.com/
_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com