Hi,
I am posting this question on behalf of a customer, to ensure it goes to the relevant forum and a place they they can see the post. Once I post this I'll share the link with the customer and ask to reply/comment here also.
They ask:
Does somebody know how to translate the following C#-Lambda-Command to Visual Cobol ?
Example (the second last line):
private void FlexGrid_Load(object sender, EventArgs e)
{
string conn = Util.GetConnectionString();
var ds = new DataSet();
string[] tables = "Customers, Orders".Split(',');
foreach (string tableName in tables)
{
Util.FillTable(ds, tableName, conn);
}
// Defining relation between master and detail grid
ds.Relations.Add("Customers_Orders",
ds.Tables["Customers"].Columns["CustomerID"],
ds.Tables["Orders"].Columns["CustomerID"]);
flexGrid.DataSource = ds;
flexGrid.DataMember = "Customers";
flexGrid.RowDetailProvider = (g, r) => new C1FlexGridRowDetail();
flexGrid.AreRowDetailsFrozen = false;
}
}They have used the C# to COBOL convertor website but the code that is returned from that gives various compile errors.
For example, if taking an example from this Microsoft page:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-expressions
C# example:
Func<int, int> square = x => x * x;
Console.WriteLine(square(5));
// Output:
//25For that the C# to COBOL convertor gives:
declare #square as type Func[binary-long, binary-long] =
delegate (x)
set return-value to x * x
end-delegate
invoke type Console::WriteLine(#square(5))
*> Output:
*> 25Customer tries that:
declare #square as type Func[binary-long, binary-long] =
delegate (x as binary-long)
set return-value to x * x
end-delegate
Get the compile message 'cannot implicitly convert anonymous method to type System.Func[binary-long, binary-long]'
I would like to ask if anyone can offer they guidance to help with this query.
Regards,
Kim



