Here is my code:
stringValue = microData.BoolValue.HasValue ? "True" : "False";
What I am trying to do is assign a stringvalue based on a Boolvalue. if BoolValue has a value I like to do the following:
Assign stringValue = "True" if BoolValue is true. Assign stringValue = "False" ib BoolValue is false.
If Boolvalue does not have a value, assign it to null.
What i have above does not seem to work.
stringValue = microData.BoolValue.HasValue ?
microData.BoolValue.ToString() :
(string)null;
尝试这个:
stringValue = BoolValue.HasValue ? BoolValue.Value ? "True" : "False" : null;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.