Can two objects have same name?

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Post Reply
Ya-hoo
Posts: 4
Joined: Fri Jan 16, 2015 12:00 pm

Can two objects have same name?

Post by Ya-hoo »

iX allows two objects linked to same tag. Can two objects have same name?

mwidger
Posts: 4
Joined: Tue Feb 24, 2015 9:37 am

Re: Can two objects have same name?

Post by mwidger »

Ya-Hoo,

I would not advise it as objects should be uniquely identifiable. The .Net framework will also complain if the object types are the same and you use the same name (although this depends on object scope - see below).

So you could have the following which will be OK (but is poor practice) as the object types are different but the name is the same.

string myVar;
int myVar;

But having 2 strings defined in the project with the same name is just asking for trouble and should be avoided (again this really depends on scope).

string myVar;
string myVar; - not allowed in .Net as the variable myVar is already defined

This applies to objects used in scripts and those that you have dragged and dropped onto the form designer.

It may be worthwhile reading up on variable scope within the .Net framework https://msdn.microsoft.com/en-us/library/ms973875.aspx
as this explains variable and method scope very well.

Hope this helps,

Post Reply