? : Operator
-
everything you should know about C# is in your C# book, in MSDN, in the C# specification[^], etc. :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Thank you , But for a certain things MSDN is Yak ! http://msdn.microsoft.com/en-us/library/ty67wk28.aspx[^]
The conditional operator is right-associative. The expression a ? b : c ? d : e is evaluated as a ? b : (c ? d : e), not as (a ? b : c) ? d : e. The conditional operator cannot be overloaded.
X|I know nothing , I know nothing ...
-
It means
if (b == null)
a = null;
else
a = a.ToString(); //this rarely makes sense, didn't you mean b.ToString()?But it's an expression instead of a statement.
-
Thank you so much , for this fast , great replay of yours , you saved me from headache :doh: I have voted for you :rose:
I know nothing , I know nothing ...
-
Thank you , But for a certain things MSDN is Yak ! http://msdn.microsoft.com/en-us/library/ty67wk28.aspx[^]
The conditional operator is right-associative. The expression a ? b : c ? d : e is evaluated as a ? b : (c ? d : e), not as (a ? b : c) ? d : e. The conditional operator cannot be overloaded.
X|I know nothing , I know nothing ...
You're right, and that's classic Microsoft - technically accurate, entirely useless information! :laugh:
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
-
You're right, and that's classic Microsoft - technically accurate, entirely useless information! :laugh:
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
"you're in an airplane" kind of stuff? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
"you're in an airplane" kind of stuff? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Exactly! :-D
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
-
Thank you , But for a certain things MSDN is Yak ! http://msdn.microsoft.com/en-us/library/ty67wk28.aspx[^]
The conditional operator is right-associative. The expression a ? b : c ? d : e is evaluated as a ? b : (c ? d : e), not as (a ? b : c) ? d : e. The conditional operator cannot be overloaded.
X|I know nothing , I know nothing ...
-
Thank you , But for a certain things MSDN is Yak ! http://msdn.microsoft.com/en-us/library/ty67wk28.aspx[^]
The conditional operator is right-associative. The expression a ? b : c ? d : e is evaluated as a ? b : (c ? d : e), not as (a ? b : c) ? d : e. The conditional operator cannot be overloaded.
X|I know nothing , I know nothing ...
-
Hi , have a good day Can anyone Explain for me what the meaning of this ?
a = b == null ? null : a.ToString();
P.S : for more information : I use this component Example Code , and I need to understand it ! http://www.gemboxsoftware.com/help/html/M_GemBox_Spreadsheet_ExcelWorksheet_ExtractToDataTable.htm[^]
if (e.ErrorID == ExtractDataError.WrongType)
{
e.DataTableValue = e.ExcelValue == null ? null : e.ExcelValue.ToString();
e.Action = ExtractDataEventAction.Continue;
}Please , Don't tell to Ask at Component Forum , due my question is C# syntax things thank you
I know nothing , I know nothing ...
-
Hi , have a good day Can anyone Explain for me what the meaning of this ?
a = b == null ? null : a.ToString();
P.S : for more information : I use this component Example Code , and I need to understand it ! http://www.gemboxsoftware.com/help/html/M_GemBox_Spreadsheet_ExcelWorksheet_ExtractToDataTable.htm[^]
if (e.ErrorID == ExtractDataError.WrongType)
{
e.DataTableValue = e.ExcelValue == null ? null : e.ExcelValue.ToString();
e.Action = ExtractDataEventAction.Continue;
}Please , Don't tell to Ask at Component Forum , due my question is C# syntax things thank you
I know nothing , I know nothing ...
-
Hi , have a good day Can anyone Explain for me what the meaning of this ?
a = b == null ? null : a.ToString();
P.S : for more information : I use this component Example Code , and I need to understand it ! http://www.gemboxsoftware.com/help/html/M_GemBox_Spreadsheet_ExcelWorksheet_ExtractToDataTable.htm[^]
if (e.ErrorID == ExtractDataError.WrongType)
{
e.DataTableValue = e.ExcelValue == null ? null : e.ExcelValue.ToString();
e.Action = ExtractDataEventAction.Continue;
}Please , Don't tell to Ask at Component Forum , due my question is C# syntax things thank you
I know nothing , I know nothing ...
? operator its like a IF-result statement. look:
int x = 0;
int y = 1;if(x > y) ? y++ : y--;
If x>y = true, y++.
If x>y = false, y--;