This post asked a similar question and used LINQ to solve it, maybe it will help you out too.
string s1 = "1;2;3;4;5;6;7;8;9;10;11;12";
int[] ia = s1.Split(';').Select(n => Convert.ToInt32(n)).ToArray();
More Related Contents:
- Get All instead of FirstOrDefault
- How to write this nested foreach loop query in LINQ?
- Group by in LINQ
- Linq: GroupBy, Sum and Count
- Find an item in a list by LINQ
- Reading a file line by line in C#
- ToList()– does it create a new list?
- Combination of List
- The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name
- How to use the IEqualityComparer
- LINQ Select Distinct with Anonymous Types
- LINQ Orderby Descending Query
- Check if two lists are equal
- How to get the closest number from a List with LINQ?
- LINQ aggregate and group by periods of time
- Enumerating Collections that are not inherently IEnumerable?
- Convert anonymous type to class
- Comparing 2 objects and retrieve a list of fields with different values
- C# Linq where clause as a variable
- Find if listA contains any elements not in listB
- Find all child controls of specific type using Enumerable.OfType() or LINQ
- LINQ to SQL using GROUP BY and COUNT(DISTINCT)
- Split an IEnumerable into fixed-sized chunks (return an IEnumerable where the inner sequences are of fixed length) [duplicate]
- Remove item from list based on condition
- Last and LastOrDefault not supported
- How to include() nested child entity in linq
- Linq OrderBy against specific values
- Explicit/implicit cast operator fails when using LINQ’s .Cast() operator
- What is the best way to check two List lists for equality in C#
- LINQ query — Data aggregation (group adjacent)