<abiz@onezero.orga écrit dans le message de news:
1167980854.896758.71240@51g2000cwl.googlegroups.co m...
| What is the current thinking about specializing generic C# types?
|
| I've come across a situation where I'd like to do something like this:
|
| struct X<T,U>
| {
| ...
| }
|
| struct XCommonCase<T= X<T,bool>
|
| Even if this example used classes and not structs, inheritance wouldn't
| quite be the right thing here. The only way I know of to get this
| specialization is to clone X in XCommonCase. It'd be nice if there
| were something better.
|
| It might also be useful to have similar specialization with generic
| methods.
What is wrong with doing what you suggest ? As long as you use a class
instead of a struct and get the syntax right, this is perfectly permissible.
class X<T, U>
{
...
}
class XCommonCase<T: X<T, bool>
{
...
}
--
Joanna Carter [TeamB]
Consultant Software Engineer