GetEnumerator().Current
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > GetEnumerator().Current




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    GetEnumerator().Current  
Jim Reynolds


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-22-05 10: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 cal
l
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





[ Post a follow-up to this message ]



    Re: GetEnumerator().Current  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-22-05 10: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







[ Post a follow-up to this message ]



    Re: GetEnumerator().Current  
Jim Reynolds


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-22-05 10: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: [url]http://tinyurl.com/6zj44[/url
]
> ----------------------
>
>
> "Jim Reynolds" <JimReynolds@discussions.microsoft.com> wrote in message
> news:DEB3C1D1-0EAA-4649-BF1C-57157B016C60@microsoft.com... 
>
>
>





[ Post a follow-up to this message ]



    Re: GetEnumerator().Current  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-22-05 10: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:
> 







[ Post a follow-up to this message ]



    Re: GetEnumerator().Current  
Jim Reynolds


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-26-05 12:56 PM

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: [url]http://tinyurl.com/6zj44[/url
]
> ----------------------
>
>
> "Jim Reynolds" <JimReynolds@discussions.microsoft.com> wrote in message
> news:F1EFE155-FF5B-42E9-AD59-4D98462D41C9@microsoft.com... 
>
>
>





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:48 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register