|
Home > Archive > Microsoft Content Management Server > July 2005 > GetEnumerator().Current
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
GetEnumerator().Current
|
|
| Jim Reynolds 2005-07-22, 5:50 pm |
| Hi,
I'm using the GetEnumerator method of the Channel.Postings collection to
iterate through. I have called MoveNext() which returns true but whaen I call
Channel.Postings.GetEnumerator().Current I get a
"The enumerator is positioned before the first element of the collection or
after the last element."
exception. There are 5 postings in the collection and I have called
Movenext, any ideas?
Jim
| |
| Stefan [MSFT] 2005-07-22, 5:50 pm |
| Hi Jim,
why don't you do it that way:
foreach (Posting p in Channel.Postings)
{
...
}
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"Jim Reynolds" <JimReynolds@discussions.microsoft.com> wrote in message
news:DEB3C1D1-0EAA-4649-BF1C-57157B016C60@microsoft.com...
> Hi,
>
> I'm using the GetEnumerator method of the Channel.Postings collection to
> iterate through. I have called MoveNext() which returns true but whaen I
> call
> Channel.Postings.GetEnumerator().Current I get a
>
> "The enumerator is positioned before the first element of the collection
> or
> after the last element."
>
> exception. There are 5 postings in the collection and I have called
> Movenext, any ideas?
>
> Jim
| |
| Jim Reynolds 2005-07-22, 5:50 pm |
| Hi Stefan,
Because I want the first four postings.
Jim
"Stefan [MSFT]" wrote:
> Hi Jim,
>
> why don't you do it that way:
>
> foreach (Posting p in Channel.Postings)
> {
> ...
> }
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
> ----------------------
>
>
> "Jim Reynolds" <JimReynolds@discussions.microsoft.com> wrote in message
> news:DEB3C1D1-0EAA-4649-BF1C-57157B016C60@microsoft.com...
>
>
>
| |
| Stefan [MSFT] 2005-07-22, 5:50 pm |
| Hi Jim,
then use the following:
for (int i=0; i<4; i++)
{
...Channel.Postings[i]...
}
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"Jim Reynolds" <JimReynolds@discussions.microsoft.com> wrote in message
news:F1EFE155-FF5B-42E9-AD59-4D98462D41C9@microsoft.com...[vbcol=seagreen]
> Hi Stefan,
>
> Because I want the first four postings.
>
> Jim
>
> "Stefan [MSFT]" wrote:
>
| |
| Jim Reynolds 2005-07-26, 7:56 am |
| Hi Stefan,
Thanks for that, I did manage to get the Enumerator way to work as well.
System.Collections.IEnumerator iEnumerator = events.Postings.GetEnumerator();
bool nextPosting = iEnumerator.MoveNext();
Posting posting = (Posting)iEnumerator.Current;
"Stefan [MSFT]" wrote:
> Hi Jim,
>
> then use the following:
>
> for (int i=0; i<4; i++)
> {
> ...Channel.Postings[i]...
> }
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
> ----------------------
>
>
> "Jim Reynolds" <JimReynolds@discussions.microsoft.com> wrote in message
> news:F1EFE155-FF5B-42E9-AD59-4D98462D41C9@microsoft.com...
>
>
>
|
|
|
|
|