Grupo de Estudos.Net Generics
Grupo de Estudos.Net OverView New Feature do.Net Framework 2.0 Conceito de tipo parametro Definir classe e métodos Generalização Reusabilidade Notará que toda referência para object é substituída pelo parâmetro genérico “T” Permite escrever códigos robustos e type safety Performance
Grupo de Estudos.Net Generics na prática In Practice
Grupo de Estudos.Net Benefits Generalização não mais feita para object Alternativa ao ArrayList (store reference and Value Type) Classe genérica, você pode criar uma coleção que é do tipo segura, em tempo de compilação.
Grupo de Estudos.Net Constraints Restringe o tipo parâmetro where T: struct [The type argument must be a value type] where T: class [The type argument must be a reference type] where T: new() [The type argument must have a public parameterless constructor.]
Grupo de Estudos.Net Constraints where T : [The type argument must be or derive from the specified base class.] where T : [The type argument must be or implement the specified interface. Multiple interface constraints can be specified.] where T : U [The type argument supplied for T must be or derive from the argument supplied for U.]
Grupo de Estudos.Net Links Constraints on Type Parameters (C# Programming Guide) Generic Methods (C# Programming Guide) Constraints on Type Parameters (C# Programming Guide) Collections Best Practice Conversão boxing e conversão unboxing