I have a problem with string.format ...
I try to pass my account ID as an argument to my program ... and the 6th argument always ends with a "-" no matter what I do (we have to use ¿because of the old program) ...
public static void OpenIdInvoice(string wdlName, string IdInvoice, Form sender){
MessageBox.Show(string.Format("¿{0}",IdInvoice));
proc.Arguments = string.Format("{0}¿{1}¿{2}¿{3}¿{4}¿{5}",
session.SessionId.ToString(),
Session.GetCurrentDatabaseName(),
session.Librairie,
wdlName,
"",
IdInvoice
);
System.Windows.Forms.MessageBox.Show(proc.Arguments);
In the end, “-” is always added to my formatted result, but only until my IdInvoice ... (so Id 10 ends with -10 in my arguments)
now the interesting part ... I hardcode the string and ...
if I pass -1 instead of Id, I have -1 as a result, and if I write "banana" ... I get "-banna" ...
I know that I could just build a string otherwise ... but I'm curious why this is happening.
Here is a screenshot
...
EDIT:
/
var proc = new System.Diagnostics.ProcessStartInfo("Achat.exe");
System.Windows.Forms.MessageBox.Show(string.Format("¿{0}",args));
proc.Arguments = string.Format(@"{0}¿{1}¿{2}¿{3}¿{4}¿{5}¿{6}",
"12346",
"fake DB",
"false",
"myScreenName",
"123456",
"Banana",
"123456"
);
System.Windows.Forms.MessageBox.Show(proc.Arguments);
System.Windows.Forms.MessageBox.Show(args);
/ :
12346. DB¿false¿myScreenName¿123456¿BananaÀ123456