Click here to Skip to main content
15,918,041 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to access multiple controls thread safe in Windows Forms Pin
#realJSOP4-Oct-10 2:03
professional#realJSOP4-Oct-10 2:03 
GeneralRe: How to access multiple controls thread safe in Windows Forms Pin
poda4-Oct-10 5:42
poda4-Oct-10 5:42 
QuestionMessage Filter Pin
electriac3-Oct-10 11:37
electriac3-Oct-10 11:37 
AnswerRe: Message Filter Pin
Henry Minute3-Oct-10 11:49
Henry Minute3-Oct-10 11:49 
AnswerRe: Message Filter Pin
Dave Kreskowiak3-Oct-10 11:58
mveDave Kreskowiak3-Oct-10 11:58 
GeneralRe: Message Filter Pin
electriac3-Oct-10 12:03
electriac3-Oct-10 12:03 
AnswerRe: Message Filter Pin
Luc Pattyn3-Oct-10 12:03
sitebuilderLuc Pattyn3-Oct-10 12:03 
QuestionYield break Pin
Brij3-Oct-10 8:12
mentorBrij3-Oct-10 8:12 
Hi all,

I was learning yield operator. And made a function like this.

public IEnumerable<Guid> GetIds(int count, DateTime time)
        {
            
            Console.WriteLine("Start");
            {
                if (DateTime.Now > time)
                    yield break;
                else
                    yield return Guid.NewGuid();
            }
            Console.WriteLine("End");
        }


But End never get printed.Can anyone tell why? Because after break statement it should get out of the loop and print it.
Cheers!!
Brij
My Blog:http://brijbhushan.wordpress.com

Check my latest Article :ViewState - Various ways to reduce performance overhead

AnswerRe: Yield break Pin
harold aptroot3-Oct-10 8:48
harold aptroot3-Oct-10 8:48 
AnswerRe: Yield break Pin
Henry Minute3-Oct-10 8:56
Henry Minute3-Oct-10 8:56 
AnswerRe: Yield break Pin
PIEBALDconsult3-Oct-10 8:58
mvePIEBALDconsult3-Oct-10 8:58 
GeneralRe: Yield break Pin
Brij3-Oct-10 9:15
mentorBrij3-Oct-10 9:15 
AnswerRe: Yield break Pin
Pete O'Hanlon3-Oct-10 9:21
mvePete O'Hanlon3-Oct-10 9:21 
GeneralRe: Yield break Pin
Brij3-Oct-10 9:28
mentorBrij3-Oct-10 9:28 
GeneralRe: Yield break Pin
Pete O'Hanlon3-Oct-10 9:42
mvePete O'Hanlon3-Oct-10 9:42 
GeneralRe: Yield break Pin
Brij3-Oct-10 9:56
mentorBrij3-Oct-10 9:56 
GeneralRe: Yield break Pin
Luc Pattyn3-Oct-10 10:16
sitebuilderLuc Pattyn3-Oct-10 10:16 
GeneralRe: Yield break Pin
Pete O'Hanlon3-Oct-10 10:56
mvePete O'Hanlon3-Oct-10 10:56 
GeneralRe: Yield break Pin
Luc Pattyn3-Oct-10 11:04
sitebuilderLuc Pattyn3-Oct-10 11:04 
GeneralRe: Yield break Pin
Pete O'Hanlon3-Oct-10 11:13
mvePete O'Hanlon3-Oct-10 11:13 
Questionscprip's system Pin
noamtzu003-Oct-10 3:48
noamtzu003-Oct-10 3:48 
QuestionTyping in DatagridviewComboboxColumn Pin
jojoba20113-Oct-10 3:47
jojoba20113-Oct-10 3:47 
AnswerSolved: Typing in DatagridviewComboboxColumn Pin
jojoba20113-Oct-10 4:51
jojoba20113-Oct-10 4:51 
AnswerRe: Typing in DatagridviewComboboxColumn Pin
Abhinav S3-Oct-10 4:59
Abhinav S3-Oct-10 4:59 
Questionf Pin
Sajid Maqbool2-Oct-10 23:34
Sajid Maqbool2-Oct-10 23:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.