I want to use -
in the code below but Visual Studio doesn't let me to use it and gives "error, unexpected character".
Name = objFileInfo.Name.Substring(0,
objFileInfo.Name.Length – objFileInfo.Extension.Length);
It is not a minus you are using:
Yours (char 8211, a math minus):
–
Minus (shorter, char 45 ascii, a dash which represents minus in C#):
-
Try copy the c# minus I use above and it will work :-)
In C# (and I imagine almost any other programming language), the minus sign is simply represented by an ASCII dash, or hyphen-minus, which is a single keystroke on standard ASCII keyboards:
-
Not the mathematical minus symbol, which you're using:
−
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With