aadowns21 Absent Member.
Absent Member.

Convert to visual cobol

I am using Visual Cobol latest version 4.7.03056 on Visual Studio 2017.  I have nearly converted most of my linq expressions to delegates and/or method groups with success.  However, I am puzzled on how to convert this simple select statement.

var query  = ingredients.Select(x => new { Name = x.Name, Length = x.Name.Length}

My take on this is not right of course, because I don't know how to do the return and setup the new {} without using a named class.


declare query = ingredients::Select(delegate(x as type Ingredients) returning ret as table of string occurs any

          new table of ret(Name = x::Name)

          new table of ret(Length = x::Length)



1 Reply
Micro Focus Expert
Micro Focus Expert

RE: Convert to visual cobol

Unfortunately there is no support for anonymous types in Visual COBOL. The only alternative I can think of is to define a class, use a System.Tuple or use an array of objects.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.