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);
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 :-)
That character... whatever character it is... is not a minus (ascii code 45).
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:
−