Oh, that's totally different than Java, but it seems to work fine. Thanks for your help!
Sandy Armstrong wrote: > > Also, each FooGen<int>, FooGen<float>, etc, is an entirely different > class, and each class has its own static members. > > So if you do FooGen<int>.f = 5, FooGen<float>.f will still be 8. So be > careful! :-) > > Sandy > > On 01/08/2009 11:46 PM, Olexandr Melnyk wrote: >> You need to specify the concrete FooGen you're referring to, as in: >> FooGen<int>.f, FooGen<float>f etc. >> >> On Fri, Jan 9, 2009 at 9:29 AM, neptune235<[email protected]> wrote: >>> 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. >>> >>> _______________________________________________ >>> Mono-list maillist - [email protected] >>> http://lists.ximian.com/mailman/listinfo/mono-list >>> >> >> >> > > _______________________________________________ > Mono-list maillist - [email protected] > http://lists.ximian.com/mailman/listinfo/mono-list > > -- View this message in context: http://www.nabble.com/How-do-I-reference-generic-classes-in-C-----tp21367430p21383256.html Sent from the Mono - General mailing list archive at Nabble.com. _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
