Partial Specialization of Generics  
Author Message
Mystagogue





PostPosted: Visual C# Language, Partial Specialization of Generics Top

I want to do something like this:

using StringDictionary<T> = System.Collections.Generic.SortedDictionary<System.String, T>;

How do I accomplish that If C# 2.0 doesn't syntactically support the notion, what is the next best equivalent




Visual C#16  
 
 
Paul Louth





PostPosted: Visual C# Language, Partial Specialization of Generics Top

Not sure if I follow totally, but if you want a sorted-dictionary where the key is always a string and the value is generic, then try this:

public class SortedStringDictionary<T> : SortedDictionary<string, T>
{

}

 


 
 
Mike Danes





PostPosted: Visual C# Language, Partial Specialization of Generics Top

Create a generic class that inherits SortedDictionary

class StringDictionary<T> : SortedDictionary<string, T>

{

}


 
 
Paul Louth





PostPosted: Visual C# Language, Partial Specialization of Generics Top

Is there an echo in here
 
 
Mike Danes





PostPosted: Visual C# Language, Partial Specialization of Generics Top

It looks like . Probably we should suggest to add some functionality to this forums like: if someone is editing a post and somebody else adds a post warn the person who is editing...