<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intrepid Blog &#187; IEnumerable</title>
	<atom:link href="http://blog.affien.com/archives/tag/ienumerable/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 01 Mar 2010 00:58:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IEnumerable to IEnumerable wrapper</title>
		<link>http://blog.affien.com/archives/2005/06/30/ienumerable-to-ienumerable-wrapper/</link>
		<comments>http://blog.affien.com/archives/2005/06/30/ienumerable-to-ienumerable-wrapper/#comments</comments>
		<pubDate>Thu, 30 Jun 2005 22:09:51 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Code sniplets]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[IEnumerable]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2005/06/30/ienumerable-to-ienumerable-wrapper/</guid>
		<description><![CDATA[A simple .net class which maps an IEnumerator to a generic IEnumerator, which is very usefull to convert from generic to non-generic collections.

using System;
using System.Collections;
using System.Collections.Generic;

namespace Intrepid.Collections.Generic
{
	public class EnumerableWrapper&#60;T&#62; : IEnumerable&#60;T&#62;
	{
		class EnumeratorWrapper : IEnumerator&#60;T&#62;
		{
			IEnumerator enumerator;

			public EnumeratorWrapper(IEnumerator enumerator)
			{
				this.enumerator = enumerator;
			}

			public void Dispose()
			{
				// maybe we should dispose the underlying IEnumerable?
			}

			public bool MoveNext()
			{
				return enumerator.MoveNext();
			}

			public void Reset()
			{
				enumerator.Reset();
			}

			object System.Collections.IEnumerator.Current
			{
				get { [...]]]></description>
			<content:encoded><![CDATA[<p>A simple .net class which maps an <code>IEnumerator</code> to a generic <code>IEnumerator<t></t></code>, which is very usefull to convert from generic to non-generic collections.<br />
<span id="more-105"></span></p>
<blockquote><pre style="font-size: larger">using System;
using System.Collections;
using System.Collections.Generic;

namespace Intrepid.Collections.Generic
{
	public class EnumerableWrapper&lt;T&gt; : IEnumerable&lt;T&gt;
	{
		class EnumeratorWrapper : IEnumerator&lt;T&gt;
		{
			IEnumerator enumerator;

			public EnumeratorWrapper(IEnumerator enumerator)
			{
				this.enumerator = enumerator;
			}

			public void Dispose()
			{
				// maybe we should dispose the underlying IEnumerable?
			}

			public bool MoveNext()
			{
				return enumerator.MoveNext();
			}

			public void Reset()
			{
				enumerator.Reset();
			}

			object System.Collections.IEnumerator.Current
			{
				get { return enumerator.Current; }
			}

			public T Current
			{
				get { return (T)enumerator.Current; }
			}
		}

		IEnumerator enumerator;

		public EnumerableWrapper (IEnumerable enumerable)
		{
			enumerator = enumerable.GetEnumerator();
		}

		public IEnumerator&lt;T&gt; GetEnumerator()
		{
			return new EnumeratorWrapper(enumerator);
		}

		IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			return enumerator;
		}
	}
}</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2005/06/30/ienumerable-to-ienumerable-wrapper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
