[Mono-list] How do I reference generic classes in C#???

neptune235 muchomuse at gmail.com
Fri Jan 9 02:29:36 EST 2009


The following Code Fails:

using System;

namespace TestGenerics
{
	//some generic class
	public class FooGen<T>
	{
		//some static attribute we want to get at
		public static int f = 8;
	}
	class MainClass
	{
		public static void Main(string[] args)
		{
			Console.WriteLine(FooGen.f);
		}
	}
}

This gives me the error: "The name 'FooGen' does not exist in this current
context (CS0103)"

Yet if I erase the <T>, making FooGen a non-generic class, it works fine. So
how do I directly access a generic class?
-- 
View this message in context: http://www.nabble.com/How-do-I-reference-generic-classes-in-C-----tp21367430p21367430.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list