var numbers = sNumbers?.Split(',')?.Select(Int32.Parse)?.ToList();
Recent versions of C# (v6+) allow you to do null checks in-line using the null-conditional operator
More Related Contents:
- Split a List into smaller lists of N size [duplicate]
- How do I clone a generic list in C#?
- Remove duplicates from a List in C#
- Check whether an array is a subset of another
- How can I split a string with a string delimiter? [duplicate]
- Remove items from one list in another
- A method to count occurrences in a list
- Splitting a string / number every Nth Character / Number?
- Select distinct using linq [duplicate]
- Getting all file names from a folder using C# [duplicate]
- Inheriting from List
- ICollection Vs List in Entity Framework
- Getting unique items from a list [duplicate]
- Fast way to convert a two dimensional array to a List ( one dimensional )
- Differences between IQueryable, List, IEnumerator?
- How to remove item from list in C#?
- Create list of variable type
- How do I get a list of installed updates and hotfixes?
- C#: How to add subitems in ListView
- How do I check if a given value is a generic list?
- Select distinct by two properties in a list
- Using Linq Except not Working as I Thought
- How to Quickly Remove Items From a List
- Casting IEnumerable to List
- How to sort a list / array of string version number?
- how to check if List element contains an item with a Particular Property Value
- Cast IList to List
- Regular expression to split string and number
- Measuring the length of string containing wide characters
- splitting a string based on multiple char delimiters