Page 1 of 2
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 5:09 pm
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
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 6:10 pm
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
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 6:43 pm
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
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 7:19 pm
by robert
John
The sporter has an option to rename the variables.
Robert
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 8:54 pm
by JKCanada604
Sporter !!!!
Where would I find such a beast?
Thank you!
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 9:03 pm
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
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 9:34 pm
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...
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Thu Sep 23, 2021 10:55 pm
by JKCanada604
Wowzer!
It worked really well!!!
Mucho gracias!!!
Cheers, JK
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Fri Sep 24, 2021 3:18 am
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
Class changes - Access / Assigns cannot have the same name as the protected ..
Posted: Fri Sep 24, 2021 8:08 am
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.
.