If you intend for a list to contain only strings, you candeclare it as (read that as “list of string”). That wayyou, your fellow programmers, and your tools can detect that assigning a non-string tothe list is probably a mistake. Here’s an example:
You discover that you want a string-specific version of this interface,so you create another interface:
Generic types can save you the trouble of creating all these interfaces.Instead, you can create a single interface that takes a type parameter: