Forum Discussion
HKosova
Alumni
14 years agoHi Shawn,
TestComplete's C#Script uses bracket notation to access object properties and methods:
So instead of
It seems to me that you are somewhat confused by this bracket syntax. I'd like to note that, despite the name, C#Script has very little to do with C#. It's a special-purpose language primarily designed to create Connected applications. So, unless you are going to do Connected apps, I'd recommend not using C#Script because it can be hard to read.
For a C#-like language with the dot syntax, use JScript.
In JScript, the same code is as follows:
TestComplete's C#Script uses bracket notation to access object properties and methods:
= new_value;
variable = object["property"];
object["method"]();
object["method"](parameters);
So instead of
msmqInfo = Sys["Messaging.MessageQueue"];it should be
msmqInfo["Path"](qname);
("Messaging.MessageQueue");
msmqInfo["Path"] = qname;It seems to me that you are somewhat confused by this bracket syntax. I'd like to note that, despite the name, C#Script has very little to do with C#. It's a special-purpose language primarily designed to create Connected applications. So, unless you are going to do Connected apps, I'd recommend not using C#Script because it can be hard to read.
For a C#-like language with the dot syntax, use JScript.
In JScript, the same code is as follows:
msmqInfo = Sys.OleObject("Messaging.MessageQueue");
msmqInfo.Path = qname;