advertisement

Article:
  C# Generics
Subject:   Templates
Date:   2004-05-19 10:13:23
From:   xeroply
For those coming from C++ background, is there any difference between C# Generics and C++ templates? They look almost identical, except for a few language syntax particularities.
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Templates
    2004-05-19 10:18:21  JesseLiberty [Reply | View]

    Aside from a few syntactic differences, the key difference is that the template is instantiated at run time, allowing the CLR to share code among various instantiations (e.g., a queue of strings, a queue of ints and a queue of Dogs) reducing code-bloat.

    You might find a bit more in the white paper on the C# spec at The C# Language Page on MSDN -- scroll down to Reference and download the C# 2.0 specification.