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?

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");

Users mailing list
[hidden email]