C# 2.0 Generics

  • Thread starter Thread starter Chuck Bowling
  • Start date Start date
C

Chuck Bowling

I assume that 2.0 will be rolled out with VS.NET 2004. Does anybody know if
MS is planning to ship an STL package with it?
 
Chuck,

While I can not say for sure, I would doubt it. There are a number of
things that differ between generics and templates, some of which are
implemented in STL which can not be implemented with generics. Because of
this alone, I would think that there wouldn't be something of this nature
distributed when generics is released.

Hope this helps.
 
While I can not say for sure, I would doubt it. There are a number of
things that differ between generics and templates, some of which are
implemented in STL which can not be implemented with generics. Because of
this alone, I would think that there wouldn't be something of this nature
distributed when generics is released.

It depends on what you mean you qualify as stl? If he's just referring to
templated collections, then Microsoft are adding generic collection to the
base class library in the System.Collections.Generic namespace. Including
generic versions of Dictionary, List, Queue and Stack. Though the
names\namespaces may change before release, there will be genric
collections.

n!
 
Chuck,

There is no such a thing like "C# Generics", there are (will be) Generics
for .NET.
That means that .NET Generics are cross-language while STL like Templates
are language specific.
Template instances are compile-time generated/specialized, once emitted to
an assembly the template ceases to exist, that means:
- that you can't instantiate a template from another assembly (MSIL code
library).
- that each language would need his own template source code package.

If you really need STL support, I would suggest you take look at the
upcoming C++ CLI, this version will support both Templates and Generics in
mixed mode assemblies,

Willy.
 
Thanks for your help Nicholas.

I'm not really interested in the structural differences between templates
and generics. I just want to be able to stick one of my objects into a
generic stack, queue or list without having to rewrite a custom version of
the collection for each object.

Nicholas Paldino said:
Chuck,

While I can not say for sure, I would doubt it. There are a number of
things that differ between generics and templates, some of which are
implemented in STL which can not be implemented with generics. Because of
this alone, I would think that there wouldn't be something of this nature
distributed when generics is released.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Chuck Bowling said:
I assume that 2.0 will be rolled out with VS.NET 2004. Does anybody know if
MS is planning to ship an STL package with it?
 
n! said:
It depends on what you mean you qualify as stl? If he's just referring to
templated collections, then Microsoft are adding generic collection to the
base class library in the System.Collections.Generic namespace. Including
generic versions of Dictionary, List, Queue and Stack. Though the
names\namespaces may change before release, there will be genric
collections.

Excellent... thanks n!.

This is exactly the information i was looking for...
 
Thank you for clarifying Willy.

I understand what C++ templates are and how to use them. As far as .NET
goes, all I want is that same functionality. While it's nice to know that
Generics are actually a characteristic of the CLI layer it doesn't get me
any closer to implementing a generic stack to use with my programs... ;)
 
Actually - at the PDC in LA recently the C# team did mention STL.NET which
is probsbly an STL-like extention written with C#2.0 generics, over and
above the simple collections that'll ship with .NET2.0

My 2c
Rob.
 
Cool... Looks like I'm gonna have to wait for VC 2004 before I lay out some
cash...
 
Back
Top