<?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>C# 411 &#187; Generics</title>
	<atom:link href="http://www.csharp411.com/category/generics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csharp411.com</link>
	<description>C# Information, Code, Tips and News</description>
	<lastBuildDate>Mon, 19 Jul 2010 14:56:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C# Empty Enumerator</title>
		<link>http://www.csharp411.com/c-empty-enumerator/</link>
		<comments>http://www.csharp411.com/c-empty-enumerator/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 13:19:20 +0000</pubDate>
		<dc:creator>timm</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.csharp411.com/c-empty-enumerator/</guid>
		<description><![CDATA[This article provides C# code for an empty enumerator.&#160; This generic class can be used to simulate enumeration over an empty collection of any type of objects.&#160; Here is the code:

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

public class EmptyEnumerator&#60;T&#62; : IEnumerator&#60;T&#62;
{
    public T Current
    {
        [...]


Related posts:<ol><li><a href='http://www.csharp411.com/convert-between-generic-ienumerablet/' rel='bookmark' title='Permanent Link: Convert Between Generic IEnumerable&#60;T&#62;'>Convert Between Generic IEnumerable&#60;T&#62;</a></li><li><a href='http://www.csharp411.com/convert-generic-icollectiont/' rel='bookmark' title='Permanent Link: Convert Generic ICollection&#60;T&#62;'>Convert Generic ICollection&#60;T&#62;</a></li><li><a href='http://www.csharp411.com/find-the-root-of-a-c-hierarchy/' rel='bookmark' title='Permanent Link: Find the Root of a C# Hierarchy'>Find the Root of a C# Hierarchy</a></li></ol>]]></description>
		<wfw:commentRss>http://www.csharp411.com/c-empty-enumerator/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Generic Class: Duplicate Method Overloads</title>
		<link>http://www.csharp411.com/generic-class-duplicate-method-overloads/</link>
		<comments>http://www.csharp411.com/generic-class-duplicate-method-overloads/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 20:21:46 +0000</pubDate>
		<dc:creator>timm</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.csharp411.com/generic-class-duplicate-method-overloads/</guid>
		<description><![CDATA[When two overloads of a method in a generic class are the same (have identical type arguments) as a result of the generic type you specified, which method is called?

For example, given a generic class named "Generic" that has an overloaded method "Add":
public class Generic&#60;T&#62;
{
    public void Add( T item )
  [...]


Related posts:<ol><li><a href='http://www.csharp411.com/convert-generic-icollectiont/' rel='bookmark' title='Permanent Link: Convert Generic ICollection&#60;T&#62;'>Convert Generic ICollection&#60;T&#62;</a></li><li><a href='http://www.csharp411.com/c-get-calling-method/' rel='bookmark' title='Permanent Link: C# Get Calling Method'>C# Get Calling Method</a></li><li><a href='http://www.csharp411.com/convert-between-generic-ienumerablet/' rel='bookmark' title='Permanent Link: Convert Between Generic IEnumerable&#60;T&#62;'>Convert Between Generic IEnumerable&#60;T&#62;</a></li></ol>]]></description>
		<wfw:commentRss>http://www.csharp411.com/generic-class-duplicate-method-overloads/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Nested Generics</title>
		<link>http://www.csharp411.com/nested-generics/</link>
		<comments>http://www.csharp411.com/nested-generics/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:24:27 +0000</pubDate>
		<dc:creator>timm</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.csharp411.com/nested-generics/</guid>
		<description><![CDATA[Given two generic classes:
public class Type1&#60;T&#62; {}
public class Type2&#60;T&#62; {}

.NET allows you to specify a generic type as the type of another generic type:
Type1&#60;Type2&#60;int&#62;&#62; obj = new Type1&#60;Type2&#60;int&#62;&#62;();


Simple Example
Consider a simple reference class that might be used for lazy-fetching an object.&#160; For simplicity, the lazy-fetching code has been removed:
public class Ref&#60;T&#62;
{
    public [...]


Related posts:<ol><li><a href='http://www.csharp411.com/generic-class-duplicate-method-overloads/' rel='bookmark' title='Permanent Link: Generic Class: Duplicate Method Overloads'>Generic Class: Duplicate Method Overloads</a></li><li><a href='http://www.csharp411.com/multiple-generic-ienumerablet/' rel='bookmark' title='Permanent Link: Multiple Generic IEnumerable&lt;T&gt;'>Multiple Generic IEnumerable&lt;T&gt;</a></li><li><a href='http://www.csharp411.com/convert-generic-icollectiont/' rel='bookmark' title='Permanent Link: Convert Generic ICollection&#60;T&#62;'>Convert Generic ICollection&#60;T&#62;</a></li></ol>]]></description>
		<wfw:commentRss>http://www.csharp411.com/nested-generics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reverse an Array</title>
		<link>http://www.csharp411.com/reverse-an-array/</link>
		<comments>http://www.csharp411.com/reverse-an-array/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 15:49:00 +0000</pubDate>
		<dc:creator>timm</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/reverse-an-array/</guid>
		<description><![CDATA[It's easy to reverse the contents of an array using C# generics:


static T[] ReverseArray&#60;T&#62;( T[] array )
{
    T[] newArray = null;
    int count = array == null ? 0 : array.Length;
    if (count &#62; 0)
    {
        [...]


Related posts:<ol><li><a href='http://www.csharp411.com/sort-c-array-in-descendingreverse-order/' rel='bookmark' title='Permanent Link: Sort C# Array in Descending/Reverse Order'>Sort C# Array in Descending/Reverse Order</a></li><li><a href='http://www.csharp411.com/c-empty-enumerator/' rel='bookmark' title='Permanent Link: C# Empty Enumerator'>C# Empty Enumerator</a></li><li><a href='http://www.csharp411.com/parse-and-sort-comma-delimited-numbers/' rel='bookmark' title='Permanent Link: Parse and Sort Comma-Delimited Numbers'>Parse and Sort Comma-Delimited Numbers</a></li></ol>]]></description>
		<wfw:commentRss>http://www.csharp411.com/reverse-an-array/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Convert Generic ICollection&lt;T&gt;</title>
		<link>http://www.csharp411.com/convert-generic-icollectiont/</link>
		<comments>http://www.csharp411.com/convert-generic-icollectiont/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 14:21:44 +0000</pubDate>
		<dc:creator>timm</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Generics-Variance]]></category>
		<category><![CDATA[ICollection]]></category>

		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/convert-generic-icollectiont/</guid>
		<description><![CDATA[As discussed in a previous article, Generics provides the ability to create strongly-typed collections in C#.  Unfortunately, C# currently does not support generics variance, which would allow inheritance of generic types.

Generics Variance: Not Allowed
For example, imagine two classes:

public class A {}
public class B : A {}

Now imagine two generic List collections and ICollection interfaces:

List&#60;A&#62; [...]


Related posts:<ol><li><a href='http://www.csharp411.com/convert-between-generic-ienumerablet/' rel='bookmark' title='Permanent Link: Convert Between Generic IEnumerable&#60;T&#62;'>Convert Between Generic IEnumerable&#60;T&#62;</a></li><li><a href='http://www.csharp411.com/c-empty-enumerator/' rel='bookmark' title='Permanent Link: C# Empty Enumerator'>C# Empty Enumerator</a></li><li><a href='http://www.csharp411.com/c-get-calling-method/' rel='bookmark' title='Permanent Link: C# Get Calling Method'>C# Get Calling Method</a></li></ol>]]></description>
		<wfw:commentRss>http://www.csharp411.com/convert-generic-icollectiont/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Convert Between Generic IEnumerable&lt;T&gt;</title>
		<link>http://www.csharp411.com/convert-between-generic-ienumerablet/</link>
		<comments>http://www.csharp411.com/convert-between-generic-ienumerablet/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 21:43:49 +0000</pubDate>
		<dc:creator>timm</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[Generics]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[C#-Generics]]></category>
		<category><![CDATA[Generics-Variance]]></category>
		<category><![CDATA[IEnumerable]]></category>
		<category><![CDATA[IEnumerator]]></category>

		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/convert-between-generic-ienumerablet/</guid>
		<description><![CDATA[Generics in .NET 2.0 provides the ability to create strongly-typed collections in C#.  Unfortunately, C# currently does not support generics variance, which would allow inheritance of generic types.
For example, consider a list of strings and a list of objects:

List&#60;string&#62; strings = new List&#60;string&#62;();
strings.Add( "hello" );
strings.Add( "goodbye" );
List&#60;object&#62; objects = new List&#60;object&#62;();
objects.AddRange( strings );

The final [...]


Related posts:<ol><li><a href='http://www.csharp411.com/convert-generic-icollectiont/' rel='bookmark' title='Permanent Link: Convert Generic ICollection&#60;T&#62;'>Convert Generic ICollection&#60;T&#62;</a></li><li><a href='http://www.csharp411.com/c-empty-enumerator/' rel='bookmark' title='Permanent Link: C# Empty Enumerator'>C# Empty Enumerator</a></li><li><a href='http://www.csharp411.com/multiple-generic-ienumerablet/' rel='bookmark' title='Permanent Link: Multiple Generic IEnumerable&lt;T&gt;'>Multiple Generic IEnumerable&lt;T&gt;</a></li></ol>]]></description>
		<wfw:commentRss>http://www.csharp411.com/convert-between-generic-ienumerablet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
