Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I declared :
IEnumerable<IPublishedContent> mediaNodeList = Umbraco.TypedMedia(mediaNodeIds)
Resulting in an IEnumerable collection of media nodes. I know that the collection does contain elements, because the .Count() method reports 2 elements.
However, the following code :
IPublishedContent myMedia = mediaNodeList.ElementAt(1);
results in the following error :
Specified argument was out of the range of valid values. Parameter name: index
And I have no idea why...
Again, any help would be appreciated!
This should work:
List<IPublishedContent> mediaNodeList = Umbraco.TypedMedia(mediaNodeIds).ToList(); IPublishedContent myMedia; if (mediaNodeList.Count >= 2) { myMedia = mediaNodeList[1]; }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
IEnumerable<IPublishedContent> ElementAt(index) method
I declared :
Resulting in an IEnumerable collection of media nodes. I know that the collection does contain elements, because the .Count() method reports 2 elements.
However, the following code :
results in the following error :
And I have no idea why...
Again, any help would be appreciated!
This should work:
is working on a reply...