C# Split Examples – C# Programming Example
C# Console String Methods

C# Split Examples

C# split method returns an array of strings, each of which is a substring of string formed by splitting it by the string delimiter.

 

Example 1: The following code splits a common phrase into an array of strings for each word

Output:

 

Example 2: The following code splits a common phrase into an array of strings by comma

Output:

 

Example 3:  The following example uses spaces, commas, periods, slash, all passed in an array containing these separating characters, to Split.

Output:

 

Example 4: C# string split to list

OR

Output:

 

Example 5: String split to custom object list

 

Output:

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: