Using Micro Focus\\Visual COBOL\\Samples\\COBOL for .NET\\Collections sample , which doesn't compile, and errors on the exact problem I'm trying to resolve.
Visual COBOL 10 Update 6.
How do I create an IF statement so based on the type I know an action to take like:
01 TableNew type System.Collections.Generic.SortedList[string, string].
01 myType object.
set myType = tablenew::GetType().
if myType is type System.Collections.Generic.SortedList[string, string]
display "Table is sorted"
*> Go do something.
else
*> Test if its a string or dictionary etc
end-if
Also not valid:
if TableNew::GetType() = type System.Collections.Generic.SortedList[string, string]
------------------------------
Neil Hayes
------------------------------
The following works if I instantiate TableNew first:
01 TableNew type System.Collections.Generic.SortedList[string, string].
01 myType object.
procedure division.
set TableNew to new type System.Collections.Generic.SortedList[string, string]
invoke TableNew::Add("test", "test2")
set myType to TableNew::GetType
if myType = type of type System.Collections.Generic.SortedList[string, string]
display "Table is sorted"
*> Go do something.
else
*> Test if its a string or dictionary etc
end-if
------------------------------
Chris Glazier
Principal Technical Support Specialist
Rocket Forum Shared Account
------------------------------
The following works if I instantiate TableNew first:
01 TableNew type System.Collections.Generic.SortedList[string, string].
01 myType object.
procedure division.
set TableNew to new type System.Collections.Generic.SortedList[string, string]
invoke TableNew::Add("test", "test2")
set myType to TableNew::GetType
if myType = type of type System.Collections.Generic.SortedList[string, string]
display "Table is sorted"
*> Go do something.
else
*> Test if its a string or dictionary etc
end-if
------------------------------
Chris Glazier
Principal Technical Support Specialist
Rocket Forum Shared Account
------------------------------
ah "type of type"
Thank you.
------------------------------
Neil Hayes
Software Development Specialist
Syspro (Pty) Ltd
Rivonia GB
------------------------------