I have a string that contains email addresses like this :
string emailIDs = "xyz@gmail.com;abc@yahoo.com;frog@gmail.com;whyme@hotmail.com;"
I want to add these emails in List. I tried splitting it at ';' but this creates an extra record in the list which causes a null exception. I want to split and add this to my List without any extra record. Please let me know how can I achieve this in c#?
I am trying like this:
List<string> To = new List<string>(emailIDs.Cc.Split(new[] { ";" },StringSplitOptions.RemoveEmptyEntries));
I am trying to remove this extra record at the end be cause Cc contains only two records: