String.Join(T) Method (String, IEnumerable(T))
Concatenates the members of a collection, using the specified separator between each member.
Assembly: mscorlib (in mscorlib.dll)
[<ComVisibleAttribute(false)>] static member Join : separator:string * values:IEnumerable<'T> -> string
The type of the members of values.
- Type: System.String
The string to use as a separator. separator is included in the returned string only if values has more than one element.
- Type: System.Collections.Generic.IEnumerable()
A collection that contains the objects to concatenate.
values is a null reference (Nothing in Visual Basic).
If separator is a null reference (Nothing in Visual Basic), an empty string (String.Empty) is used instead. If any member of values is a null reference (Nothing in Visual Basic), an empty string is used instead.
is a convenience method that lets you concatenate each member of an IEnumerable(T) collection without first converting them to strings. The string representation of each object in the IEnumerable(T) collection is derived by calling that object's ToString method.
This method is particular useful with Language-Integrated Query (LINQ) query expressions. For example, the following code defines a very simple Animal class that contains the name of an animal and the order to which it belongs. It then defines a List(T) object that contains a number of Animal objects. The Enumerable.Where extension method is called to extract the Animal objects whose Order property equals "Rodent". The result is passed to the method.
The following example uses the Sieve of Eratosthenes algorithm to calculate the prime numbers that are less than or equal to 100. It assigns the result to a List(T) object of type integer, which it then passes to the method.