✅ Operator ! cannot be applied to type string
yeah I cannot really test this properly since Visual Studio is not available in my current operating system. Though, I am using an online compiler to debug this in some way, shape or form.
I haven't coded in C# in so long but I am contributing to an installer made in C# so how do I check if a special folder exists, and if not, add a different folder to the
shortcutPaths
?
I'm just so used to coding in Java that I use the !
operator when I mean something "isn't there."12 Replies
prefixing everything with
!
is a javascript thingand a java thing in some scenarios
since "!undefined" is false
no
in both java and C#, !true == false
java does not have truth conversions the way JS has
no I mean in Java you can use the
!
operator in a bit more scenarios than C#Show me an example
I know it because I've programmed in Java more than I did with C#
where it works in java but not in C#
mainly in booleans for sure
okay maybe it's the same in both languages
I'll admit that
It is, unless Java recentyl added some weird stuff 😛
so its common with methods that return bools
but you cant do it on
Environment.GetFolderPath
because that returns a string
agreed, that's where the confusion could come from
okay thanks guys very amazing! 👍
How do I mark this as solved and automatically close post?
/close
okay thanks