I usually create a sequence from a single value using array syntax, like this:
IEnumerable<string> sequence = new string[] { "abc" };
Or using a new List. I’d like to hear if anyone has a more expressive way to do the same thing.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your example is not an empty sequence, it’s a sequence with one element. To create an empty sequence of strings you can do
EDIT OP clarified they were looking to create a single value. In that case