Click here to Skip to main content
15,867,594 members
Articles / Desktop Programming / WPF
Alternative
Tip/Trick

TIP: Handling WPF DialogResult with simplicity

Rate me:
Please Sign up or sign in to vote.
1.71/5 (8 votes)
28 Jun 2010CPOL 15.2K   2   9
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)


Written By
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: I like both: frm.ShowDialog(); if (frm.DialogResul... Pin
votecoffee29-May-11 23:44
votecoffee29-May-11 23:44 
GeneralReason for my vote of 5 It's very simple and readable. Is th... Pin
osam12-Jul-11 7:28
osam12-Jul-11 7:28 
GeneralReason for my vote of 3 Not as readable. Pin
votecoffee29-May-11 7:47
votecoffee29-May-11 7:47 
GeneralProgramming isn't just about having the shortest code or eve... Pin
votecoffee29-May-11 7:46
votecoffee29-May-11 7:46 
GeneralRe: And?... Which alternative you prefer and why? Pin
Thornik29-May-11 22:58
Thornik29-May-11 22:58 
GeneralYep, your two lines example is definitely shorter than my in... Pin
Thornik7-Sep-10 23:13
Thornik7-Sep-10 23:13 
GeneralWhat looks shorter and understandable is: if (f.DialogResult... Pin
Jaime Olivares5-Sep-10 22:18
Jaime Olivares5-Sep-10 22:18 
GeneralOh, OK, "if (frm.DialogResult.HasValue && frm.DialogResult.V... Pin
Thornik20-Jul-10 0:23
Thornik20-Jul-10 0:23 
GeneralI really like so much the ?? operator, but in this case does... Pin
Jaime Olivares28-Jun-10 20:44
Jaime Olivares28-Jun-10 20: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.