Im geting lost in My “Self” and “me”
I have a computed property in a Class.
How can I return the Name of it
me.name?
me.self?
Im geting lost in My “Self” and “me”
I have a computed property in a Class.
How can I return the Name of it
me.name?
me.self?
Me and Self in a class are the same thing. I think I use Self more but I don’t think it matters.
Where it does matter is when you are in a control event on a Window/Page/Container. Me will refer to the control and Self refers to the Window/Page/Container.
Yeah, it’s a little confusing but the only place it really matters is in the Control Events.
[quote=239247:@Jay Menna]Im geting lost in My “Self” and “me”
I have a computed property in a Class.
How can I return the Name of it
[/quote]
Which IT ?
The name of the property ?
The name of the class ?
Since the meaning of “Self” depends on the context (class definition vs. instance on a window), I use Self only in an instance, to refer to the window. Everywhere else, I use Me, which is unambiguous regardless of context.
I’m not clear what you want either, but if you are looking to have a computed property return the name of the class, you can do so using Introspection:
Using Xojo.Introspection
Dim info As TypeInfo = GetType(Self)
Return info.Name
Introspection can also be used to get the names of computed properties on a class.
[quote=239255:@Norman Palardy]Which IT ?
The name of the property ?
The name of the class ?[/quote]
The name of the Computed Property
Introspection on the class is as close as you’ll get
Get the class & iterate over the properties until you get to “this one” - which is a task to figure out
Why in the world do you need the name of the property ?
Solved it.
CurrentMethodName gets a string back that contains the name of the computed property.
Using split I can extract the name itself.