template classes??????
-
argh, can you define template classes in c#???? Or is there an alternative that Microsoft would prefer you to use? :mad: Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
-
argh, can you define template classes in c#???? Or is there an alternative that Microsoft would prefer you to use? :mad: Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
-
argh, can you define template classes in c#???? Or is there an alternative that Microsoft would prefer you to use? :mad: Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
Templates don't exist in C#, this is coming in Version 2. There is a "trick" that'll help you get by until then.
using System;
using T = System.Int32;namespace Test
{
class Testing
{
public Testing()
{
Console.Writeline(typeof(T).ToString());
}
}
}Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002
-
Templates don't exist in C#, this is coming in Version 2. There is a "trick" that'll help you get by until then.
using System;
using T = System.Int32;namespace Test
{
class Testing
{
public Testing()
{
Console.Writeline(typeof(T).ToString());
}
}
}Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002
Thanks for the response, I wanted to port a generic tree class over to C# but looks like I can't for the minute, or maybe I can. What if the class took a type of Object? class Testing { public Testing(Object arg) { m_Object = arg; } Object m_Object; } I'm very new to C#, but would this work? Also when is version 2 out??? Thanks again Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
-
Thanks for the response, I wanted to port a generic tree class over to C# but looks like I can't for the minute, or maybe I can. What if the class took a type of Object? class Testing { public Testing(Object arg) { m_Object = arg; } Object m_Object; } I'm very new to C#, but would this work? Also when is version 2 out??? Thanks again Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.
TheFLC wrote: What if the class took a type of Object? That would work, but you would have lots of casting to do (Object could be called the equivalent of void* in C). This is generally the reason that the technique I mentioned came up; while you'll have a specific class for each type of tree; you'll eliminate all casting. TheFLC wrote: Also when is version 2 out??? Not for a while, version 1.0 came out a week ago today :) My guess would be at least a year before version 2.0 comes out. James James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002
-
argh, can you define template classes in c#???? Or is there an alternative that Microsoft would prefer you to use? :mad: Windows 98 (win-doze): a 32 bit Extension to a 16 bit Graphical Shell of an 8 bit Operating System originally coded for a 4 bit Processor by a 2 bit company that can't stand one bit of competition.