List Extensions
Extensions to lists...

ToImmutableList

Changes a list from mutable (Changeable) to immutable(Not changeable).

                        IEnumerable<T> ToImmutableList<T>(this IEnumerable<T> sourceList);Example:
                        IList<int> list1 = new List<int>{2, 4, 6, 8};   
IList<int> immutableList = list1.ToImmutableList(); 
                    

ReplaceWith

Replaces a list items with another ones items.

                        IEnumerable<T> ReplaceWith<T>(this IList<T> sourceList, IEnumerable<T> targetList);Example:
                        IList<int> list1 = new List<int>{2, 4, 6, 8};   
IList<int> list2 = new List<int>(); 
list2.ReplaceWith(list1);

                    

PickRandomItem

Picks one item through the list randomly..

                        T PickRandomItem<T>(this IList<T> sourceList);Example:
                        IList<int> list1 = new List<int>{2, 4, 6, 8};   
int randomItem = list1.PickRandomItem(); 
                    

Join

Joins string array into a single string separated via delimiter.

                        string Join(this IEnumerable<string> texts, string delimiter);Example:
                        string[] texts = new string[]{"one", "two", "three"};   
string result = texts.Join(","); // "one,two,three"
                    

AsList

Converts IEnumerable to list, if it is already a List it returns the list itself.

                        IList<T> AsList<T>(IEnumerable<T> sourceList);Example:
                        IEnumerable<T> collection = ...;   
IList<T> result = collection.AsList(); // "one,two,three"
                    

ToCSV

Converts Generic list type into CSV file.

                        void ToCSV<T>(IEnumerable<T> entities, string path, bool append = false);Example:
                        IEnumerable<T> collection = ...;   
collection.ToCSV("c:\collections.csv"); 
                    

ToCSVAsync

Converts Generic list type into CSV file asynchronously

                        void ToCSVAsync<T>(IEnumerable<T> entities, string path, bool append = false);Example:
                        IEnumerable<T> collection = ...;     
collection.ToCSVAsync("c:\collections.csv");