Click here to Skip to main content
12,635,167 members (23,497 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

8.3K views
2 bookmarked
Posted

TIP: Handling WPF DialogResult with simplicity

, 28 Jun 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
May be this is better?if (f.ShowDialog() ?? false) { // ebat' melkosoft za takie prikoly}
May be this is better?

if (f.ShowDialog() ?? false) {
   // ebat' melkosoft za takie prikoly
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Thornik
South Africa South Africa
No Biography provided

You may also be interested in...

Pro

Comments and Discussions

 
GeneralRe: I like both: frm.ShowDialog(); if (frm.DialogResul... Pin
votecoffee30-May-11 0:44
membervotecoffee30-May-11 0:44 
GeneralReason for my vote of 5 It's very simple and readable. Is th... Pin
osam12-Jul-11 8:28
memberosam12-Jul-11 8:28 
GeneralReason for my vote of 3 Not as readable. Pin
votecoffee29-May-11 8:47
membervotecoffee29-May-11 8:47 
GeneralProgramming isn't just about having the shortest code or eve... Pin
votecoffee29-May-11 8:46
membervotecoffee29-May-11 8:46 
GeneralRe: And?... Which alternative you prefer and why? Pin
Member 308248729-May-11 23:58
memberMember 308248729-May-11 23:58 
GeneralYep, your two lines example is definitely shorter than my in... Pin
Member 30824878-Sep-10 0:13
memberMember 30824878-Sep-10 0:13 
GeneralWhat looks shorter and understandable is: if (f.DialogResult... Pin
Jaime Olivares5-Sep-10 23:18
memberJaime Olivares5-Sep-10 23:18 
GeneralOh, OK, "if (frm.DialogResult.HasValue && frm.DialogResult.V... Pin
Member 308248720-Jul-10 1:23
memberMember 308248720-Jul-10 1:23 
Oh, OK, "if (frm.DialogResult.HasValue && frm.DialogResult.Value) " is much shorter and understandable. Got it! Smile | :)
GeneralI really like so much the ?? operator, but in this case does... Pin
Jaime Olivares28-Jun-10 21:44
memberJaime Olivares28-Jun-10 21:44 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 28 Jun 2010
Article Copyright 2010 by Thornik
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid