Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Sunday, March 7, 2010 7:15 AM
Okay, I have this IEnumerable veriable named GradeProfiles
some where part of my code, I want to add an Item to the IEnumrable.. How can I possibly add another Item of the same type of that IEnumerable to GradeProfiles?
IEnumerable<XElement> GradeProfile;
//somewhere part of my program, add the items in GradeProfile, like GradeProfile.add(), or is there such thing?
All replies (2)
Sunday, March 7, 2010 7:24 AM âś…Answered | 1 vote
Sorry, but I have to say that IEnumerables are only for enumerating. you can't add item to them directly and you should add the item to it's underlying source instead.My Blog - MSDN Complement by providing Visual C# Walkthroughs and Sample Codes - Founded In February 24, 2010
Friday, May 9, 2014 9:53 PM | 2 votes
What you are looking for is concat
IEnumerable<string> stringcol = new IEnumerable<string>();
stringcol = stringcol.Concat(new[] { "foo" });
Try that.