Click here to Skip to main content
15,880,967 members
Home / Discussions / C#
   

C#

 
Questiongenerics question Pin
George_George10-May-08 22:35
George_George10-May-08 22:35 
AnswerRe: generics question Pin
carbon_golem11-May-08 7:25
carbon_golem11-May-08 7:25 
GeneralRe: generics question Pin
George_George11-May-08 15:18
George_George11-May-08 15:18 
GeneralRe: generics question Pin
S. Senthil Kumar11-May-08 19:31
S. Senthil Kumar11-May-08 19:31 
GeneralRe: generics question Pin
George_George11-May-08 21:45
George_George11-May-08 21:45 
GeneralRe: generics question Pin
S. Senthil Kumar11-May-08 22:45
S. Senthil Kumar11-May-08 22:45 
GeneralRe: generics question Pin
George_George11-May-08 23:06
George_George11-May-08 23:06 
GeneralRe: generics question Pin
S. Senthil Kumar11-May-08 23:59
S. Senthil Kumar11-May-08 23:59 
George_George wrote:
I think the points from the document is, we can not use open constructed type, but only can use close constructed type as type parameter to generics, right? I think I already provide the open constructed type -- List<generic2><t>> gen1, but it could still compile.


No, the point is that you cannot pass a generic type itself as a generic parameter. Have you heard about template template parameters in C++? You can do something like
template <typename T, template <typename> Container>
class A
{

}


You can then do A<std::string, std::vector> . Note that std::vector itself is a template class, which is why the second type parameter for A has another template keyword.

You can't do that with generics.


George_George wrote:
Why you stress the point that a different assembly?


It doesn't matter - I wrote it that way to stress the fact that generic type information needs to be preserved in assemblies and won't be compiled away like in C++.

Regards
Senthil [MVP - Visual C#]
_____________________________
My Blog | My Articles | My Flickr | WinMacro

GeneralRe: generics question Pin
George_George12-May-08 1:28
George_George12-May-08 1:28 
GeneralRe: generics question Pin
S. Senthil Kumar12-May-08 2:17
S. Senthil Kumar12-May-08 2:17 
GeneralRe: generics question Pin
George_George12-May-08 2:32
George_George12-May-08 2:32 
QuestionFile header processing... [modified] Pin
natsuyaki10-May-08 22:00
natsuyaki10-May-08 22:00 
AnswerRe: File header processing... Pin
DanB198310-May-08 23:14
DanB198310-May-08 23:14 
GeneralRe: File header processing... Pin
natsuyaki10-May-08 23:34
natsuyaki10-May-08 23:34 
GeneralRe: File header processing... Pin
DanB198310-May-08 23:52
DanB198310-May-08 23:52 
GeneralRe: File header processing... Pin
natsuyaki10-May-08 23:59
natsuyaki10-May-08 23:59 
AnswerRe: File header processing... Pin
boblaw9911-May-08 4:13
boblaw9911-May-08 4:13 
GeneralRe: File header processing... Pin
natsuyaki11-May-08 4:24
natsuyaki11-May-08 4:24 
AnswerRe: File header processing... Pin
boblaw9911-May-08 5:03
boblaw9911-May-08 5:03 
GeneralRe: File header processing... Pin
natsuyaki11-May-08 5:16
natsuyaki11-May-08 5:16 
AnswerRe: File header processing... Pin
boblaw9911-May-08 5:22
boblaw9911-May-08 5:22 
GeneralRe: File header processing... Pin
natsuyaki11-May-08 5:34
natsuyaki11-May-08 5:34 
Questionmeta data and attribute Pin
George_George10-May-08 21:43
George_George10-May-08 21:43 
AnswerRe: meta data and attribute Pin
natsuyaki10-May-08 22:05
natsuyaki10-May-08 22:05 
GeneralRe: meta data and attribute Pin
George_George10-May-08 22:21
George_George10-May-08 22:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.