Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi,
Is there a substitution for booleans, e.g. if bool1 false then return bool2... If there's more then two boolean vals. then check which one is true and return it, e.g. check bool1, ...2, ..3,... bool n - true - then return true.
Looking for similar functions that used in SQL:
NVL(string, replace_string) - if string is false then return replace string.
or
COALESCE(expression1,...n) - equivalent to the following CASE expression:
COALESCE(expression1,...n)
CASE
WHEN (expression1 IS NOT NULL) THEN expression1
WHEN (expression2 IS NOT NULL) THEN expression2
...
ELSE expressionN
END
Is there such thing in C# in general that can be used with numbers and strings? If there is can this be used for boolean expressions/values?
Thank you very much.
Can you help answer these questions from other members on NexusFi?
Hi,
Thank you for your reply. But I could not understand the example. I was looking for if a is null or 0 (zero) then return b. Can you please make another example with exact syntax? How would I actually write in my program if a = 0 then return b or if string a is " " (blank) then return string b? Can this be used with booleans?
Thank you.
Thank you for your reply. The first question, is there a single line command/method/statement such as Coalesce (expr1,...2....3....n) in C# or I must use switch statement in such cases? Another question, can switch be used with booleans? If not then what can be used with boolean expressions?
Thank you very much.