GetType() with Interface

Posted by bheavican on 29-Dec-2010 11:24

This code used to work but when we upgraded to 10.2B0205 from 10.2B0108 it quit.

IMyInterface is an interface.

IMyInterface:GetType():ToString() gives a syntax error Could not locate element 'GetType' in class 'src.MyClass'. (12927) in 10.2B0205.

Is anyone else having this problem?  This should work correctly right?

All Replies

Posted by Admin on 29-Dec-2010 11:32

For ABL Interfaces I'd expect GetClass():FullName to work, not the GetType() method. Progress.Lang.Object has no member GetType(), which is a member of System.Object.

When that did work on an earlier patch, I'd say that a bug got fixed now.

Posted by bheavican on 29-Dec-2010 12:41

Your guess that "a bug got fixed" was how I thought of it as well.  In Visual Studio GetType() works for interfaces.  The intellisense in VS shows Equals, GetHashCode, GetType, ToString, along with the interface methods and properties.

Posted by Peter Judge on 29-Dec-2010 12:57

You can use the static GetClass() method on the Progress.Lang.Class object to get this stuff, in addition to the GetClass() instance method on any PLO. GetClass() is the ABL equivalent of GetType(). It's mighty useful, I find.

So,

using Progress.Lang.Class.

message Class:GetClass('OpenEdge.Core.Util.IExternalizable'):Package.

Will show "OpenEdge.Core.Util".

-- peter

Posted by Admin on 29-Dec-2010 13:02

bheavican schrieb:

In Visual Studio GetType() works for interfaces.

That's the point. In the Visual Studio you are defining a .NET Interface. In the ABL you are defining an ABL Interface.

GetType() is a method in the .NET Framework only. Available in the ABL only on hybrids. And as the ABL does not (yet) support Interface inheritance there are NO ABL Interfaces that inherit from .NET. Hence no GetType() on ABL Interfaces.

Posted by jquerijero on 12-Jan-2011 13:39

Any reason why GetType() used to work?

Posted by Admin on 12-Jan-2011 13:47

jquerijero schrieb:

Any reason why GetType() used to work?

used?

GetType() still works for .NET types.

This thread is closed