c# Introducing Generics

C Sharp > c# Introducing Generics
23.01.2017 14:06:07


Наиболее часто встречающиеся слова в статье:

[Customlist] [Introducing] [Generics] [   Create] [classes] [interfaces] [include] [type parameter] [ public] [   Specify]


Статья:

Introducing Generics
•    Create classes and interfaces that include a type parameter
public class Customlist<T>
 
{
public T this[int index] { get; set; }
 
 public void Add(T item) { ... }
 
 public void Remove(T item) { ... }
 
}
•    Specify the type argument when you instantiate the class
Customlist<Coffee> coffees = new CustomList<Coffee>();