Class changes - Access / Assigns cannot have the same name as the protected ..

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
JKCanada604
Posts: 49
Joined: Wed Aug 11, 2021 11:03 am

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by JKCanada604 »

Good day to you all!

I have just stumbled into an enormous body of work due to the fact that in X# one cannot have an access / assign with the same name as a member.

Unfortunately, all my classes written in VO use the same name for the member, the access and the assign.

This turns out to be an enormous amount of work which I have already started.

What I am doing is renaming the protected variables to “X_..” and then dealing with all the errors.

Any ideas / recommendations would be really helpful!

As always thank you, keep well and,

Cheers, JK
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by wriedmann »

Hi John,
unfortunately this is not a limitation of X# itself, but of the .NET Framework.
There is another limitation: there cannot be a method and a access or assign with the same name.
Wolfgang
P.S. I'm using the underscore alone to distinguish my protect variables - that makes also my code easier to read because I see immediatly if a variable is a local or a protected variable
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
JKCanada604
Posts: 49
Joined: Wed Aug 11, 2021 11:03 am

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by JKCanada604 »

Hi there!

Ok - I am on exactly the same page...

Just a lot of changes to do - not hard but tedious!

As always, thank you, keep well and,

Cheers, JK
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by robert »

John
The sporter has an option to rename the variables.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
JKCanada604
Posts: 49
Joined: Wed Aug 11, 2021 11:03 am

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by JKCanada604 »

Sporter !!!!

Where would I find such a beast?

Thank you!
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by robert »

John,
That was a typo.
I meant the VOXporter.
See https://www.xsharp.eu/help/example-1-th ... examp.html
Enable the checkbox "CheckForIVarAndPropertyConflicts"

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by Chris »

Robert,

Arghh, I had completely forgotten I had implemented this in the VOXporter (after you had had suggested to do so)! I think the latest threads in the last days have given enough ideas for a "VO to X#" part 3 session...
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
JKCanada604
Posts: 49
Joined: Wed Aug 11, 2021 11:03 am

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by JKCanada604 »

Wowzer!

It worked really well!!!

Mucho gracias!!!

Cheers, JK
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by wriedmann »

Hi Chris,
so I don't feel that stupid now as I had not even noted that option in the VOXporter.
A question: do you are renaming the declaration only or also the places where it is used? (I see that a bit risky, and since I try to fix my code always on the VO side I don't think I will use this option)
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Class changes - Access / Assigns cannot have the same name as the protected ..

Post by Chris »

HI Wolfgang,

It adjusts also the places where it is used. I agree it is a bit risky, this is why the option is disabled by default. But in our tests I think we haven't found any problems so far.

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply