This specifically is a namespace of the .Net . See another question . Like in PHP if something is inside a namespace , it needs to be "imported" to have access to its members (unless it uses the full name).
Obviously the library containing these types needs to be referenced in the project too . But that's another problem outside the language itself.
Select() method is a generic algorithm for manipulating any type that is a
IEnumerable (you have ask about this interface ). You have Multiple Algorithms as well. This is part of the query language enumerable data collections , called LINQ .
The documentation shows the interfaces implemented by type
Array (because the linked class here is just a utility for the type that is native to the language and does not represent the type itself, as is often the case with other types).
The methods that are in that particular namespace are extension methods a> (specifically in static class
Enumerable ( get her source )), then they appear to be of the type itself, but are external, so they need to be explicitly referenced - through the namespace - when you want to use them.
Could be normal functions (normal static methods), but would lose the syntax uniformity and the ease of finding out what is available for the type when using a self-completion engine for an IDE.
Using the extension method:
Using the normal static method:
Example in dotNetFiddle .
I will not go into details about extension methods because you already have a specific question goes up and we do not need repeat here.
You have a not-recommended technique for not having to do this in your extension methods: it creates the class that will contain these methods within the namespace that will usually have the types they extend. For example, if you put your methods in
namespace System , then they are likely to always be available. But you run the risk of having collisions of names for free.
See more about LINQ .
Usage sample .