user1025901
user1025901

Reputation: 1909

In generics how can we set one type exactly similar to another?

What is wrong

public class GameInitializatorAdaptee<u> : CollectionInitializationAdapter<Game, v> where v:u

Error: The type or namespace name 'v' could not be found (are you missing a using directive or an assembly reference?)

How can i do it?

Idea is v should be equal to u..

Thanks

Upvotes: 0

Views: 38

Answers (1)

richardtallent
richardtallent

Reputation: 35404

If I understand you correctly, this should work:

public class GameInitializatorAdaptee<u> : 
  CollectionInitializationAdapter<Game, u>

"u" is the placeholder for your generic type.

Upvotes: 1

Related Questions